
##### Load Packages and Data #####
library(tidyverse)
# Reminder - Load Post and Postsim functions!
# Note: To generate a figure in the R viewer, do NOT run dev.off() after running code for a figure. Alternatively, un-comment the file paths to save the figures. 

#setwd("")

##### Table 4E #####

Replication <- read.csv("replication.csv", header = TRUE)
Data_Post2016 <- Replication[Replication$year != 2014,]

trade_post2016 <- lm(dv_imports ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample3 + sample4 + engagement, data = Data_Post2016)
summary(trade_post2016)


##### Figures 5A, 5B, and 5C ######
Qualtrics2014 <- Replication[Replication$year == 2014,]

## Model Type 1 - OLS, No Interactions Between Traits and Engagement 

# Left-Right Identification
mod1_lr_nfc <- lm(dv_lr ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_lr_open <- lm(dv_lr ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_lr_schw <- lm(dv_lr ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_lr_auth <- lm(dv_lr ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_lr_latent <- lm(dv_lr ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Economic Issue Preferences
mod1_econ_nfc <- lm(dv_econ ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_econ_open <- lm(dv_econ ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_econ_schw <- lm(dv_econ ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_econ_auth <- lm(dv_econ ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_econ_latent <- lm(dv_econ ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Social Issue Preferences
mod1_social_nfc <- lm(dv_social ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_social_open <- lm(dv_social ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_social_schw <- lm(dv_social ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_social_auth <- lm(dv_social ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_social_latent <- lm(dv_social ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Trade Issue Preferences
mod1_imports_nfc <- lm(dv_imports ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_imports_open <- lm(dv_imports ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_imports_schw <- lm(dv_imports ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_imports_auth <- lm(dv_imports ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_imports_latent <- lm(dv_imports ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Limited Government 
mod1_limgov_nfc <- lm(dv_limgov ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_limgov_open <- lm(dv_limgov ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_limgov_schw <- lm(dv_limgov ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_limgov_auth <- lm(dv_limgov ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_limgov_latent <- lm(dv_limgov ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Moral Traditionalism
mod1_trad_nfc <- lm(dv_trad ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_trad_open <- lm(dv_trad ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_trad_schw <- lm(dv_trad ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_trad_auth <- lm(dv_trad ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod1_trad_latent <- lm(dv_trad ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

## Put Parameters/Errors in Data Frame ##

model1Frame <- data.frame(Variable = rownames(summary(mod1_lr_auth)$coef),
                          Coefficient = summary(mod1_lr_auth)$coef[, 1],
                          SE = summary(mod1_lr_auth)$coef[, 2],
                          Domain = "Left-Right Identification")
model1Frame <- model1Frame[2,]

model2Frame <- data.frame(Variable = rownames(summary(mod1_lr_open)$coef),
                          Coefficient = summary(mod1_lr_open)$coef[, 1],
                          SE = summary(mod1_lr_open)$coef[, 2],
                          Domain = "Left-Right Identification")
model2Frame <- model2Frame[2,]

model3Frame <- data.frame(Variable = rownames(summary(mod1_lr_nfc)$coef),
                          Coefficient = summary(mod1_lr_nfc)$coef[, 1],
                          SE = summary(mod1_lr_nfc)$coef[, 2],
                          Domain = "Left-Right Identification")
model3Frame <- model3Frame[2,]

model4Frame <- data.frame(Variable = rownames(summary(mod1_lr_schw)$coef),
                          Coefficient = summary(mod1_lr_schw)$coef[, 1],
                          SE = summary(mod1_lr_schw)$coef[, 2],
                          Domain = "Left-Right Identification")
model4Frame <- model4Frame[2,]

model5Frame <- data.frame(Variable = rownames(summary(mod1_lr_latent)$coef),
                          Coefficient = summary(mod1_lr_latent)$coef[, 1],
                          SE = summary(mod1_lr_latent)$coef[, 2],
                          Domain = "Left-Right Identification")
model5Frame <- model5Frame[2,]

model6Frame <- data.frame(Variable = rownames(summary(mod1_social_auth)$coef),
                          Coefficient = summary(mod1_social_auth)$coef[, 1],
                          SE = summary(mod1_social_auth)$coef[, 2],
                          Domain = "Cultural Policy")
model6Frame <- model6Frame[2,]

model7Frame <- data.frame(Variable = rownames(summary(mod1_social_open)$coef),
                          Coefficient = summary(mod1_social_open)$coef[, 1],
                          SE = summary(mod1_social_open)$coef[, 2],
                          Domain = "Cultural Policy")
model7Frame <- model7Frame[2,]

model8Frame <- data.frame(Variable = rownames(summary(mod1_social_nfc)$coef),
                          Coefficient = summary(mod1_social_nfc)$coef[, 1],
                          SE = summary(mod1_social_nfc)$coef[, 2],
                          Domain = "Cultural Policy")
model8Frame <- model8Frame[2,]

model9Frame <- data.frame(Variable = rownames(summary(mod1_social_schw)$coef),
                          Coefficient = summary(mod1_social_schw)$coef[, 1],
                          SE = summary(mod1_social_schw)$coef[, 2],
                          Domain = "Cultural Policy")
model9Frame <- model9Frame[2,]

model10Frame <- data.frame(Variable = rownames(summary(mod1_social_latent)$coef),
                           Coefficient = summary(mod1_social_latent)$coef[, 1],
                           SE = summary(mod1_social_latent)$coef[, 2],
                           Domain = "Cultural Policy")
model10Frame <- model10Frame[2,]

model11Frame <- data.frame(Variable = rownames(summary(mod1_trad_auth)$coef),
                           Coefficient = summary(mod1_trad_auth)$coef[, 1],
                           SE = summary(mod1_trad_auth)$coef[, 2],
                           Domain = "Moral Traditionalism")
model11Frame <- model11Frame[2,]

model12Frame <- data.frame(Variable = rownames(summary(mod1_trad_open)$coef),
                           Coefficient = summary(mod1_trad_open)$coef[, 1],
                           SE = summary(mod1_trad_open)$coef[, 2],
                           Domain = "Moral Traditionalism")
model12Frame <- model12Frame[2,]

model13Frame <- data.frame(Variable = rownames(summary(mod1_trad_nfc)$coef),
                           Coefficient = summary(mod1_trad_nfc)$coef[, 1],
                           SE = summary(mod1_trad_nfc)$coef[, 2],
                           Domain = "Moral Traditionalism")
model13Frame <- model13Frame[2,]

model14Frame <- data.frame(Variable = rownames(summary(mod1_trad_schw)$coef),
                           Coefficient = summary(mod1_trad_schw)$coef[, 1],
                           SE = summary(mod1_trad_schw)$coef[, 2],
                           Domain = "Moral Traditionalism")
model14Frame <- model14Frame[2,]

model15Frame <- data.frame(Variable = rownames(summary(mod1_trad_latent)$coef),
                           Coefficient = summary(mod1_trad_latent)$coef[, 1],
                           SE = summary(mod1_trad_latent)$coef[, 2],
                           Domain = "Moral Traditionalism")
model15Frame <- model15Frame[2,]

model16Frame <- data.frame(Variable = rownames(summary(mod1_econ_auth)$coef),
                           Coefficient = summary(mod1_econ_auth)$coef[, 1],
                           SE = summary(mod1_econ_auth)$coef[, 2],
                           Domain = "Economic Policy")
model16Frame <- model16Frame[2,]

model17Frame <- data.frame(Variable = rownames(summary(mod1_econ_open)$coef),
                           Coefficient = summary(mod1_econ_open)$coef[, 1],
                           SE = summary(mod1_econ_open)$coef[, 2],
                           Domain = "Economic Policy")
model17Frame <- model17Frame[2,]

model18Frame <- data.frame(Variable = rownames(summary(mod1_econ_nfc)$coef),
                           Coefficient = summary(mod1_econ_nfc)$coef[, 1],
                           SE = summary(mod1_econ_nfc)$coef[, 2],
                           Domain = "Economic Policy")
model18Frame <- model18Frame[2,]

model19Frame <- data.frame(Variable = rownames(summary(mod1_econ_schw)$coef),
                           Coefficient = summary(mod1_econ_schw)$coef[, 1],
                           SE = summary(mod1_econ_schw)$coef[, 2],
                           Domain = "Economic Policy")
model19Frame <- model19Frame[2,]

model20Frame <- data.frame(Variable = rownames(summary(mod1_econ_latent)$coef),
                           Coefficient = summary(mod1_econ_latent)$coef[, 1],
                           SE = summary(mod1_econ_latent)$coef[, 2],
                           Domain = "Economic Policy")
model20Frame <- model20Frame[2,]

model21Frame <- data.frame(Variable = rownames(summary(mod1_limgov_auth)$coef),
                           Coefficient = summary(mod1_limgov_auth)$coef[, 1],
                           SE = summary(mod1_limgov_auth)$coef[, 2],
                           Domain = "Limited Government")
model21Frame <- model21Frame[2,]

model22Frame <- data.frame(Variable = rownames(summary(mod1_limgov_open)$coef),
                           Coefficient = summary(mod1_limgov_open)$coef[, 1],
                           SE = summary(mod1_limgov_open)$coef[, 2],
                           Domain = "Limited Government")
model22Frame <- model22Frame[2,]

model23Frame <- data.frame(Variable = rownames(summary(mod1_limgov_nfc)$coef),
                           Coefficient = summary(mod1_limgov_nfc)$coef[, 1],
                           SE = summary(mod1_limgov_nfc)$coef[, 2],
                           Domain = "Limited Government")
model23Frame <- model23Frame[2,]

model24Frame <- data.frame(Variable = rownames(summary(mod1_limgov_schw)$coef),
                           Coefficient = summary(mod1_limgov_schw)$coef[, 1],
                           SE = summary(mod1_limgov_schw)$coef[, 2],
                           Domain = "Limited Government")
model24Frame <- model24Frame[2,]

model25Frame <- data.frame(Variable = rownames(summary(mod1_limgov_latent)$coef),
                           Coefficient = summary(mod1_limgov_latent)$coef[, 1],
                           SE = summary(mod1_limgov_latent)$coef[, 2],
                           Domain = "Limited Government")
model25Frame <- model25Frame[2,]

model26Frame <- data.frame(Variable = rownames(summary(mod1_imports_auth)$coef),
                           Coefficient = summary(mod1_imports_auth)$coef[, 1],
                           SE = summary(mod1_imports_auth)$coef[, 2],
                           Domain = "Free Trade")
model26Frame <- model26Frame[2,]

model27Frame <- data.frame(Variable = rownames(summary(mod1_imports_open)$coef),
                           Coefficient = summary(mod1_imports_open)$coef[, 1],
                           SE = summary(mod1_imports_open)$coef[, 2],
                           Domain = "Free Trade")
model27Frame <- model27Frame[2,]

model28Frame <- data.frame(Variable = rownames(summary(mod1_imports_nfc)$coef),
                           Coefficient = summary(mod1_imports_nfc)$coef[, 1],
                           SE = summary(mod1_imports_nfc)$coef[, 2],
                           Domain = "Free Trade")
model28Frame <- model28Frame[2,]

model29Frame <- data.frame(Variable = rownames(summary(mod1_imports_schw)$coef),
                           Coefficient = summary(mod1_imports_schw)$coef[, 1],
                           SE = summary(mod1_imports_schw)$coef[, 2],
                           Domain = "Free Trade")
model29Frame <- model29Frame[2,]

model30Frame <- data.frame(Variable = rownames(summary(mod1_imports_latent)$coef),
                           Coefficient = summary(mod1_imports_latent)$coef[, 1],
                           SE = summary(mod1_imports_latent)$coef[, 2],
                           Domain = "Free Trade")
model30Frame <- model30Frame[2,]

allModelFrame <- data.frame(rbind(model1Frame, model2Frame, model3Frame, model4Frame, model5Frame, #lr
                                  model6Frame, model7Frame, model8Frame, model9Frame, model10Frame, #cultural
                                  model11Frame, model12Frame,  model13Frame, model14Frame, model15Frame, #moral
                                  model16Frame, model17Frame, model18Frame, model19Frame, model20Frame, # econ
                                  model21Frame, model22Frame, model23Frame,  model24Frame, model25Frame, #limgov
                                  model26Frame, model27Frame, model28Frame, model29Frame, model30Frame)) # trade

allModelFrame$Domain <- factor(allModelFrame$Domain, 
                               levels = c("Left-Right Identification", "Cultural Policy", "Moral Traditionalism", "Economic Policy", "Limited Government", "Free Trade"))
allModelFrame$Variable <- factor(allModelFrame$Variable, 
                                 levels = c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"))

interval2 <- -qnorm((1-0.95)/2) # set 95% CI

zp1 <- ggplot(allModelFrame, aes(x = Domain, y = Coefficient, shape =  Variable))

zp1 <- zp1 + geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)

zp1 <- zp1 + geom_pointrange(aes(x = Domain, y = Coefficient, ymin = Coefficient - SE*interval2, 
                                 ymax = Coefficient + SE*interval2), lwd = 1/2, position = position_dodge(width = 1/2))

zp1 <- zp1 + scale_shape_manual(name = "Personality Measure", 
                                values = c(0,2,1,6,5),
                                breaks=c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"),
                                labels=c("Authoritarianism", "Openness to Experience (RC)", "Need for Closure", "Schwartz Conservation Values", "Latent Openness (RC)"))

zp1 <- zp1 + theme_bw() + theme(text=element_text(family="Times", face="bold", size=12)) +
  theme(axis.title.x = element_blank())
zp1 <- zp1  + ylim(-.35,.68)

zp1
#ggsave(file="", zp1, width = 12, height = 5) 

## Interaction Analysis ##

## Model Type 2 - OLS With Interactions Between Traits and Engagement 

# Left-Right Identification
mod2_lr_nfc <- lm(dv_lr ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_lr_open <- lm(dv_lr ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_lr_schw <- lm(dv_lr ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_lr_auth <- lm(dv_lr ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_lr_latent <- lm(dv_lr ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Economic Issue Preferences
mod2_econ_nfc <- lm(dv_econ ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_econ_open <- lm(dv_econ ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_econ_schw <- lm(dv_econ ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_econ_auth <- lm(dv_econ ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_econ_latent <- lm(dv_econ ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Social Issue Preferences
mod2_social_nfc <- lm(dv_social ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_social_open <- lm(dv_social ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_social_schw <- lm(dv_social ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_social_auth <- lm(dv_social ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_social_latent <- lm(dv_social ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Trade Imports Preferences
mod2_imports_nfc <- lm(dv_imports ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_imports_open <- lm(dv_imports ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_imports_schw <- lm(dv_imports ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_imports_auth <- lm(dv_imports ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_imports_latent <- lm(dv_imports ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Limited Government
mod2_limgov_nfc <- lm(dv_limgov ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_limgov_open <- lm(dv_limgov ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_limgov_schw <- lm(dv_limgov ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_limgov_auth <- lm(dv_limgov ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_limgov_latent <- lm(dv_limgov ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

# Moral Traditionalism
mod2_trad_nfc <- lm(dv_trad ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_trad_open <- lm(dv_trad ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_trad_schw <- lm(dv_trad ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_trad_auth <- lm(dv_trad ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)
mod2_trad_latent <- lm(dv_trad ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Qualtrics2014)

## Effects from 5th to 95th Percentile of Personality Type
attach(Qualtrics2014)

quantile(nfc_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(open_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(schw_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(auth_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(latent_scale,  probs = c(0.05, 0.95), na.rm = T)

# Left-Right Identification
lr_nfc <- post(mod2_lr_nfc, x1name =  "nfc_scale", x1vals = c(.304,.864), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_open <- post(mod2_lr_open, x1name =  "open_scale", x1vals = c(0,.729), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_schw <- post(mod2_lr_schw, x1name =  "schw_scale", x1vals = c(.292,.833), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_auth <- post(mod2_lr_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_latent <- post(mod2_lr_latent, x1name =  "latent_scale", x1vals = c(.205,.757), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Economic Preferences
econ_nfc <- post(mod2_econ_nfc, x1name =  "nfc_scale", x1vals = c(.304,.864), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_open <- post(mod2_econ_open, x1name =  "open_scale", x1vals = c(0,.729), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_schw <- post(mod2_econ_schw, x1name =  "schw_scale", x1vals = c(.292,.833), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_auth <- post(mod2_econ_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_latent <- post(mod2_econ_latent, x1name =  "latent_scale", x1vals = c(.205,.757), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Social Preferences
social_nfc <- post(mod2_social_nfc, x1name =  "nfc_scale", x1vals = c(.304,.864), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_open <- post(mod2_social_open, x1name =  "open_scale", x1vals = c(0,.729), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_schw <- post(mod2_social_schw, x1name =  "schw_scale", x1vals = c(.292,.833), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_auth <- post(mod2_social_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_latent <- post(mod2_social_latent, x1name =  "latent_scale", x1vals = c(.205,.757), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Trade Import Preferences
imports_nfc <- post(mod2_imports_nfc, x1name =  "nfc_scale", x1vals = c(.304,.864), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_open <- post(mod2_imports_open, x1name =  "open_scale", x1vals = c(0,.729), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_schw <- post(mod2_imports_schw, x1name =  "schw_scale", x1vals = c(.292,.833), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_auth <- post(mod2_imports_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_latent <- post(mod2_imports_latent, x1name =  "latent_scale", x1vals = c(.205,.757), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Limited Government Preference
limgov_nfc <- post(mod2_limgov_nfc, x1name =  "nfc_scale", x1vals = c(.304,.864), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_open <- post(mod2_limgov_open, x1name =  "open_scale", x1vals = c(0,.729), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_schw <- post(mod2_limgov_schw, x1name =  "schw_scale", x1vals = c(.292,.833), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_auth <- post(mod2_limgov_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_latent <- post(mod2_limgov_latent, x1name =  "latent_scale", x1vals = c(.205,.757), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Moral Traditionalism Preference
trad_nfc <- post(mod2_trad_nfc, x1name =  "nfc_scale", x1vals = c(.304,.864), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_open <- post(mod2_trad_open, x1name =  "open_scale", x1vals = c(0,.729), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_schw <- post(mod2_trad_schw, x1name =  "schw_scale", x1vals = c(.292,.833), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_auth <- post(mod2_trad_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_latent <- post(mod2_trad_latent, x1name =  "latent_scale", x1vals = c(.205,.757), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

detach(Qualtrics2014)

## Generate Interaction Plots for 4 Personality Measures ##

# LR-ID
#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_auth@est[3,1,1], lr_auth@est[3,1,2], lr_auth@est[3,1,3], lr_auth@est[3,1,4], lr_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.3,.60), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_auth@est[3,2,1], lr_auth@est[3,2,2], lr_auth@est[3,2,3], lr_auth@est[3,2,4], lr_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_auth@est[3,3,1], lr_auth@est[3,3,2], lr_auth@est[3,3,3], lr_auth@est[3,3,4], lr_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_open@est[3,1,1], lr_open@est[3,1,2], lr_open@est[3,1,3], lr_open@est[3,1,4], lr_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.3,.60), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_open@est[3,2,1], lr_open@est[3,2,2], lr_open@est[3,2,3], lr_open@est[3,2,4], lr_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_open@est[3,3,1], lr_open@est[3,3,2], lr_open@est[3,3,3], lr_open@est[3,3,4], lr_open@est[3,3,5]))
abline(h=0, lty=3)

title("Left-Right Identification", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_nfc@est[3,1,1], lr_nfc@est[3,1,2], lr_nfc@est[3,1,3], lr_nfc@est[3,1,4], lr_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.3,.60), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_nfc@est[3,2,1], lr_nfc@est[3,2,2], lr_nfc@est[3,2,3], lr_nfc@est[3,2,4], lr_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_nfc@est[3,3,1], lr_nfc@est[3,3,2], lr_nfc@est[3,3,3], lr_nfc@est[3,3,4], lr_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_schw@est[3,1,1], lr_schw@est[3,1,2], lr_schw@est[3,1,3], lr_schw@est[3,1,4], lr_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.3,.60), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_schw@est[3,2,1], lr_schw@est[3,2,2], lr_schw@est[3,2,3], lr_schw@est[3,2,4], lr_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_schw@est[3,3,1], lr_schw@est[3,3,2], lr_schw@est[3,3,3], lr_schw@est[3,3,4], lr_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

# Economic Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_auth@est[3,1,1], econ_auth@est[3,1,2], econ_auth@est[3,1,3], econ_auth@est[3,1,4], econ_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.50), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_auth@est[3,2,1], econ_auth@est[3,2,2], econ_auth@est[3,2,3], econ_auth@est[3,2,4], econ_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_auth@est[3,3,1], econ_auth@est[3,3,2], econ_auth@est[3,3,3], econ_auth@est[3,3,4], econ_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_open@est[3,1,1], econ_open@est[3,1,2], econ_open@est[3,1,3], econ_open@est[3,1,4], econ_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.50), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_open@est[3,2,1], econ_open@est[3,2,2], econ_open@est[3,2,3], econ_open@est[3,2,4], econ_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_open@est[3,3,1], econ_open@est[3,3,2], econ_open@est[3,3,3], econ_open@est[3,3,4], econ_open@est[3,3,5]))
abline(h=0, lty=3)

title("Economic Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_nfc@est[3,1,1], econ_nfc@est[3,1,2], econ_nfc@est[3,1,3], econ_nfc@est[3,1,4], econ_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.50), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_nfc@est[3,2,1], econ_nfc@est[3,2,2], econ_nfc@est[3,2,3], econ_nfc@est[3,2,4], econ_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_nfc@est[3,3,1], econ_nfc@est[3,3,2], econ_nfc@est[3,3,3], econ_nfc@est[3,3,4], econ_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_schw@est[3,1,1], econ_schw@est[3,1,2], econ_schw@est[3,1,3], econ_schw@est[3,1,4], econ_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.50), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_schw@est[3,2,1], econ_schw@est[3,2,2], econ_schw@est[3,2,3], econ_schw@est[3,2,4], econ_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_schw@est[3,3,1], econ_schw@est[3,3,2], econ_schw@est[3,3,3], econ_schw@est[3,3,4], econ_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Social Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_auth@est[3,1,1], social_auth@est[3,1,2], social_auth@est[3,1,3], social_auth@est[3,1,4], social_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.60), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_auth@est[3,2,1], social_auth@est[3,2,2], social_auth@est[3,2,3], social_auth@est[3,2,4], social_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_auth@est[3,3,1], social_auth@est[3,3,2], social_auth@est[3,3,3], social_auth@est[3,3,4], social_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_open@est[3,1,1], social_open@est[3,1,2], social_open@est[3,1,3], social_open@est[3,1,4], social_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.60), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_open@est[3,2,1], social_open@est[3,2,2], social_open@est[3,2,3], social_open@est[3,2,4], social_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_open@est[3,3,1], social_open@est[3,3,2], social_open@est[3,3,3], social_open@est[3,3,4], social_open@est[3,3,5]))
abline(h=0, lty=3)

title("Cultural Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_nfc@est[3,1,1], social_nfc@est[3,1,2], social_nfc@est[3,1,3], social_nfc@est[3,1,4], social_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.60), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_nfc@est[3,2,1], social_nfc@est[3,2,2], social_nfc@est[3,2,3], social_nfc@est[3,2,4], social_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_nfc@est[3,3,1], social_nfc@est[3,3,2], social_nfc@est[3,3,3], social_nfc@est[3,3,4], social_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_schw@est[3,1,1], social_schw@est[3,1,2], social_schw@est[3,1,3], social_schw@est[3,1,4], social_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.60), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_schw@est[3,2,1], social_schw@est[3,2,2], social_schw@est[3,2,3], social_schw@est[3,2,4], social_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_schw@est[3,3,1], social_schw@est[3,3,2], social_schw@est[3,3,3], social_schw@est[3,3,4], social_schw@est[3,3,5]))
abline(h=0, lty=3)


dev.off()

## Imports

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_auth@est[3,1,1], imports_auth@est[3,1,2], imports_auth@est[3,1,3], imports_auth@est[3,1,4], imports_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.45,.4), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.50, -.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("","-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_auth@est[3,2,1], imports_auth@est[3,2,2], imports_auth@est[3,2,3], imports_auth@est[3,2,4], imports_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_auth@est[3,3,1], imports_auth@est[3,3,2], imports_auth@est[3,3,3], imports_auth@est[3,3,4], imports_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_open@est[3,1,1], imports_open@est[3,1,2], imports_open@est[3,1,3], imports_open@est[3,1,4], imports_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.45,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.50, -.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("","-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_open@est[3,2,1], imports_open@est[3,2,2], imports_open@est[3,2,3], imports_open@est[3,2,4], imports_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_open@est[3,3,1], imports_open@est[3,3,2], imports_open@est[3,3,3], imports_open@est[3,3,4], imports_open@est[3,3,5]))
abline(h=0, lty=3)

title("Free Trade Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_nfc@est[3,1,1], imports_nfc@est[3,1,2], imports_nfc@est[3,1,3], imports_nfc@est[3,1,4], imports_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.45,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.50, -.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("","-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_nfc@est[3,2,1], imports_nfc@est[3,2,2], imports_nfc@est[3,2,3], imports_nfc@est[3,2,4], imports_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_nfc@est[3,3,1], imports_nfc@est[3,3,2], imports_nfc@est[3,3,3], imports_nfc@est[3,3,4], imports_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_schw@est[3,1,1], imports_schw@est[3,1,2], imports_schw@est[3,1,3], imports_schw@est[3,1,4], imports_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.45,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.50, -.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("","-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_schw@est[3,2,1], imports_schw@est[3,2,2], imports_schw@est[3,2,3], imports_schw@est[3,2,4], imports_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_schw@est[3,3,1], imports_schw@est[3,3,2], imports_schw@est[3,3,3], imports_schw@est[3,3,4], imports_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Limited Government Index

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_auth@est[3,1,1], limgov_auth@est[3,1,2], limgov_auth@est[3,1,3], limgov_auth@est[3,1,4], limgov_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.80,.80), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.80, -.60,-.40,-.20,.00,.20,.40,.60, .80), labels=c("-.80","","-.40","",".00","",".40","", ".80"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_auth@est[3,2,1], limgov_auth@est[3,2,2], limgov_auth@est[3,2,3], limgov_auth@est[3,2,4], limgov_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_auth@est[3,3,1], limgov_auth@est[3,3,2], limgov_auth@est[3,3,3], limgov_auth@est[3,3,4], limgov_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_open@est[3,1,1], limgov_open@est[3,1,2], limgov_open@est[3,1,3], limgov_open@est[3,1,4], limgov_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.80,.80), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.80, -.60,-.40,-.20,.00,.20,.40,.60, .80), labels=c("-.80","","-.40","",".00","",".40","", ".80"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_open@est[3,2,1], limgov_open@est[3,2,2], limgov_open@est[3,2,3], limgov_open@est[3,2,4], limgov_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_open@est[3,3,1], limgov_open@est[3,3,2], limgov_open@est[3,3,3], limgov_open@est[3,3,4], limgov_open@est[3,3,5]))
abline(h=0, lty=3)

title("Principles of Limited Government", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_nfc@est[3,1,1], limgov_nfc@est[3,1,2], limgov_nfc@est[3,1,3], limgov_nfc@est[3,1,4], limgov_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.80,.80), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.80, -.60,-.40,-.20,.00,.20,.40,.60, .80), labels=c("-.80","","-.40","",".00","",".40","", ".80"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_nfc@est[3,2,1], limgov_nfc@est[3,2,2], limgov_nfc@est[3,2,3], limgov_nfc@est[3,2,4], limgov_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_nfc@est[3,3,1], limgov_nfc@est[3,3,2], limgov_nfc@est[3,3,3], limgov_nfc@est[3,3,4], limgov_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_schw@est[3,1,1], limgov_schw@est[3,1,2], limgov_schw@est[3,1,3], limgov_schw@est[3,1,4], limgov_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.80,.80), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.80, -.60,-.40,-.20,.00,.20,.40,.60, .80), labels=c("-.80","","-.40","",".00","",".40","", ".80"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_schw@est[3,2,1], limgov_schw@est[3,2,2], limgov_schw@est[3,2,3], limgov_schw@est[3,2,4], limgov_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_schw@est[3,3,1], limgov_schw@est[3,3,2], limgov_schw@est[3,3,3], limgov_schw@est[3,3,4], limgov_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Moral Traditionalism

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_auth@est[3,1,1], trad_auth@est[3,1,2], trad_auth@est[3,1,3], trad_auth@est[3,1,4], trad_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.25,.70), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60, .70, .80), labels=c("","-.20","",".00","",".20","", ".40", "", ".60", "", ",80"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_auth@est[3,2,1], trad_auth@est[3,2,2], trad_auth@est[3,2,3], trad_auth@est[3,2,4], trad_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_auth@est[3,3,1], trad_auth@est[3,3,2], trad_auth@est[3,3,3], trad_auth@est[3,3,4], trad_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_open@est[3,1,1], trad_open@est[3,1,2], trad_open@est[3,1,3], trad_open@est[3,1,4], trad_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.25,.70), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60, .70, .80), labels=c("","-.20","",".00","",".20","", ".40", "", ".60", "", ",80"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_open@est[3,2,1], trad_open@est[3,2,2], trad_open@est[3,2,3], trad_open@est[3,2,4], trad_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_open@est[3,3,1], trad_open@est[3,3,2], trad_open@est[3,3,3], trad_open@est[3,3,4], trad_open@est[3,3,5]))
abline(h=0, lty=3)

title("Moral Traditionalism", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_nfc@est[3,1,1], trad_nfc@est[3,1,2], trad_nfc@est[3,1,3], trad_nfc@est[3,1,4], trad_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.25,.70), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60, .70, .80), labels=c("","-.20","",".00","",".20","", ".40", "", ".60", "", ",80"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_nfc@est[3,2,1], trad_nfc@est[3,2,2], trad_nfc@est[3,2,3], trad_nfc@est[3,2,4], trad_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_nfc@est[3,3,1], trad_nfc@est[3,3,2], trad_nfc@est[3,3,3], trad_nfc@est[3,3,4], trad_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_schw@est[3,1,1], trad_schw@est[3,1,2], trad_schw@est[3,1,3], trad_schw@est[3,1,4], trad_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.25,.70), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60, .70, .80), labels=c("","-.20","",".00","",".20","", ".40", "", ".60", "", ",80"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_schw@est[3,2,1], trad_schw@est[3,2,2], trad_schw@est[3,2,3], trad_schw@est[3,2,4], trad_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_schw@est[3,3,1], trad_schw@est[3,3,2], trad_schw@est[3,3,3], trad_schw@est[3,3,4], trad_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## OPENNESS FIGURE 

#jpeg(file="", type="cairo", height = 10, width = 8.5, family="sans", units = 'in', res=1800, pointsize=12)

par(mfrow=c(3,2))

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_latent@est[3,1,1], lr_latent@est[3,1,2], lr_latent@est[3,1,3], lr_latent@est[3,1,4], lr_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.45,.60), 
     xlim=c(0,1))
title(main=list("Panel A: Left-Right Identification"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_latent@est[3,2,1], lr_latent@est[3,2,2], lr_latent@est[3,2,3], lr_latent@est[3,2,4], lr_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_latent@est[3,3,1], lr_latent@est[3,3,2], lr_latent@est[3,3,3], lr_latent@est[3,3,4], lr_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_latent@est[3,1,1], social_latent@est[3,1,2], social_latent@est[3,1,3], social_latent@est[3,1,4], social_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.45,.60), 
     xlim=c(0,1))
title(main=list("Panel B: Cultural Policy Preferences"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_latent@est[3,2,1], social_latent@est[3,2,2], social_latent@est[3,2,3], social_latent@est[3,2,4], social_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_latent@est[3,3,1], social_latent@est[3,3,2], social_latent@est[3,3,3], social_latent@est[3,3,4], social_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_latent@est[3,1,1], trad_latent@est[3,1,2], trad_latent@est[3,1,3], trad_latent@est[3,1,4], trad_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.45,.60), 
     xlim=c(0,1))
title(main=list("Panel C: Moral Traditionalism"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_latent@est[3,2,1], trad_latent@est[3,2,2], trad_latent@est[3,2,3], trad_latent@est[3,2,4], trad_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_latent@est[3,3,1], trad_latent@est[3,3,2], trad_latent@est[3,3,3], trad_latent@est[3,3,4], trad_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_latent@est[3,1,1], econ_latent@est[3,1,2], econ_latent@est[3,1,3], econ_latent@est[3,1,4], econ_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.45,.60), 
     xlim=c(0,1))
title(main=list("Panel D: Economic Policy Preferences"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_latent@est[3,2,1], econ_latent@est[3,2,2], econ_latent@est[3,2,3], econ_latent@est[3,2,4], econ_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_latent@est[3,3,1], econ_latent@est[3,3,2], econ_latent@est[3,3,3], econ_latent@est[3,3,4], econ_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_latent@est[3,1,1], limgov_latent@est[3,1,2], limgov_latent@est[3,1,3], limgov_latent@est[3,1,4], limgov_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.45,.60), 
     xlim=c(0,1))
title(main=list("Panel E: Principles of Limited Government"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_latent@est[3,2,1], limgov_latent@est[3,2,2], limgov_latent@est[3,2,3], limgov_latent@est[3,2,4], limgov_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_latent@est[3,3,1], limgov_latent@est[3,3,2], limgov_latent@est[3,3,3], limgov_latent@est[3,3,4], limgov_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_latent@est[3,1,1], imports_latent@est[3,1,2], imports_latent@est[3,1,3], imports_latent@est[3,1,4], imports_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.45,.60), 
     xlim=c(0,1))
title(main=list("Panel F: Free Trade Preferences"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_latent@est[3,2,1], imports_latent@est[3,2,2], imports_latent@est[3,2,3], imports_latent@est[3,2,4], imports_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_latent@est[3,3,1], imports_latent@est[3,3,2], imports_latent@est[3,3,3], imports_latent@est[3,3,4], imports_latent@est[3,3,5]))
abline(h=0, lty=3)

dev.off()


##### Figures 5D, 5E, and 5F ######
Lucid2018 <- Replication[Replication$year == 2018,]

## Model Type 1 - OLS, No Interactions Between Traits and Engagement 

# Left-Right Identification
mod1_lr_nfc <- lm(dv_lr ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_lr_open <- lm(dv_lr ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_lr_schw <- lm(dv_lr ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_lr_auth <- lm(dv_lr ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_lr_latent <- lm(dv_lr ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Economic Issue Preferences
mod1_econ_nfc <- lm(dv_econ ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_econ_open <- lm(dv_econ ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_econ_schw <- lm(dv_econ ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_econ_auth <- lm(dv_econ ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_econ_latent <- lm(dv_econ ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Social Issue Preferences
mod1_social_nfc <- lm(dv_social ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_social_open <- lm(dv_social ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_social_schw <- lm(dv_social ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_social_auth <- lm(dv_social ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_social_latent <- lm(dv_social ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Trade Issue Preferences
mod1_imports_nfc <- lm(dv_imports ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_imports_open <- lm(dv_imports ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_imports_schw <- lm(dv_imports ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_imports_auth <- lm(dv_imports ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_imports_latent <- lm(dv_imports ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Limited Government 
mod1_limgov_nfc <- lm(dv_limgov ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_limgov_open <- lm(dv_limgov ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_limgov_schw <- lm(dv_limgov ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_limgov_auth <- lm(dv_limgov ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_limgov_latent <- lm(dv_limgov ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Moral Traditionalism
mod1_trad_nfc <- lm(dv_trad ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_trad_open <- lm(dv_trad ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_trad_schw <- lm(dv_trad ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_trad_auth <- lm(dv_trad ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod1_trad_latent <- lm(dv_trad ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

## Put Parameters/Errors in Data Frame ##

model1Frame <- data.frame(Variable = rownames(summary(mod1_lr_auth)$coef),
                          Coefficient = summary(mod1_lr_auth)$coef[, 1],
                          SE = summary(mod1_lr_auth)$coef[, 2],
                          Domain = "Left-Right Identification")
model1Frame <- model1Frame[2,]

model2Frame <- data.frame(Variable = rownames(summary(mod1_lr_open)$coef),
                          Coefficient = summary(mod1_lr_open)$coef[, 1],
                          SE = summary(mod1_lr_open)$coef[, 2],
                          Domain = "Left-Right Identification")
model2Frame <- model2Frame[2,]

model3Frame <- data.frame(Variable = rownames(summary(mod1_lr_nfc)$coef),
                          Coefficient = summary(mod1_lr_nfc)$coef[, 1],
                          SE = summary(mod1_lr_nfc)$coef[, 2],
                          Domain = "Left-Right Identification")
model3Frame <- model3Frame[2,]

model4Frame <- data.frame(Variable = rownames(summary(mod1_lr_schw)$coef),
                          Coefficient = summary(mod1_lr_schw)$coef[, 1],
                          SE = summary(mod1_lr_schw)$coef[, 2],
                          Domain = "Left-Right Identification")
model4Frame <- model4Frame[2,]

model5Frame <- data.frame(Variable = rownames(summary(mod1_lr_latent)$coef),
                          Coefficient = summary(mod1_lr_latent)$coef[, 1],
                          SE = summary(mod1_lr_latent)$coef[, 2],
                          Domain = "Left-Right Identification")
model5Frame <- model5Frame[2,]

model6Frame <- data.frame(Variable = rownames(summary(mod1_social_auth)$coef),
                          Coefficient = summary(mod1_social_auth)$coef[, 1],
                          SE = summary(mod1_social_auth)$coef[, 2],
                          Domain = "Cultural Policy")
model6Frame <- model6Frame[2,]

model7Frame <- data.frame(Variable = rownames(summary(mod1_social_open)$coef),
                          Coefficient = summary(mod1_social_open)$coef[, 1],
                          SE = summary(mod1_social_open)$coef[, 2],
                          Domain = "Cultural Policy")
model7Frame <- model7Frame[2,]

model8Frame <- data.frame(Variable = rownames(summary(mod1_social_nfc)$coef),
                          Coefficient = summary(mod1_social_nfc)$coef[, 1],
                          SE = summary(mod1_social_nfc)$coef[, 2],
                          Domain = "Cultural Policy")
model8Frame <- model8Frame[2,]

model9Frame <- data.frame(Variable = rownames(summary(mod1_social_schw)$coef),
                          Coefficient = summary(mod1_social_schw)$coef[, 1],
                          SE = summary(mod1_social_schw)$coef[, 2],
                          Domain = "Cultural Policy")
model9Frame <- model9Frame[2,]

model10Frame <- data.frame(Variable = rownames(summary(mod1_social_latent)$coef),
                           Coefficient = summary(mod1_social_latent)$coef[, 1],
                           SE = summary(mod1_social_latent)$coef[, 2],
                           Domain = "Cultural Policy")
model10Frame <- model10Frame[2,]

model11Frame <- data.frame(Variable = rownames(summary(mod1_trad_auth)$coef),
                           Coefficient = summary(mod1_trad_auth)$coef[, 1],
                           SE = summary(mod1_trad_auth)$coef[, 2],
                           Domain = "Moral Traditionalism")
model11Frame <- model11Frame[2,]

model12Frame <- data.frame(Variable = rownames(summary(mod1_trad_open)$coef),
                           Coefficient = summary(mod1_trad_open)$coef[, 1],
                           SE = summary(mod1_trad_open)$coef[, 2],
                           Domain = "Moral Traditionalism")
model12Frame <- model12Frame[2,]

model13Frame <- data.frame(Variable = rownames(summary(mod1_trad_nfc)$coef),
                           Coefficient = summary(mod1_trad_nfc)$coef[, 1],
                           SE = summary(mod1_trad_nfc)$coef[, 2],
                           Domain = "Moral Traditionalism")
model13Frame <- model13Frame[2,]

model14Frame <- data.frame(Variable = rownames(summary(mod1_trad_schw)$coef),
                           Coefficient = summary(mod1_trad_schw)$coef[, 1],
                           SE = summary(mod1_trad_schw)$coef[, 2],
                           Domain = "Moral Traditionalism")
model14Frame <- model14Frame[2,]

model15Frame <- data.frame(Variable = rownames(summary(mod1_trad_latent)$coef),
                           Coefficient = summary(mod1_trad_latent)$coef[, 1],
                           SE = summary(mod1_trad_latent)$coef[, 2],
                           Domain = "Moral Traditionalism")
model15Frame <- model15Frame[2,]

model16Frame <- data.frame(Variable = rownames(summary(mod1_econ_auth)$coef),
                           Coefficient = summary(mod1_econ_auth)$coef[, 1],
                           SE = summary(mod1_econ_auth)$coef[, 2],
                           Domain = "Economic Policy")
model16Frame <- model16Frame[2,]

model17Frame <- data.frame(Variable = rownames(summary(mod1_econ_open)$coef),
                           Coefficient = summary(mod1_econ_open)$coef[, 1],
                           SE = summary(mod1_econ_open)$coef[, 2],
                           Domain = "Economic Policy")
model17Frame <- model17Frame[2,]

model18Frame <- data.frame(Variable = rownames(summary(mod1_econ_nfc)$coef),
                           Coefficient = summary(mod1_econ_nfc)$coef[, 1],
                           SE = summary(mod1_econ_nfc)$coef[, 2],
                           Domain = "Economic Policy")
model18Frame <- model18Frame[2,]

model19Frame <- data.frame(Variable = rownames(summary(mod1_econ_schw)$coef),
                           Coefficient = summary(mod1_econ_schw)$coef[, 1],
                           SE = summary(mod1_econ_schw)$coef[, 2],
                           Domain = "Economic Policy")
model19Frame <- model19Frame[2,]

model20Frame <- data.frame(Variable = rownames(summary(mod1_econ_latent)$coef),
                           Coefficient = summary(mod1_econ_latent)$coef[, 1],
                           SE = summary(mod1_econ_latent)$coef[, 2],
                           Domain = "Economic Policy")
model20Frame <- model20Frame[2,]

model21Frame <- data.frame(Variable = rownames(summary(mod1_limgov_auth)$coef),
                           Coefficient = summary(mod1_limgov_auth)$coef[, 1],
                           SE = summary(mod1_limgov_auth)$coef[, 2],
                           Domain = "Limited Government")
model21Frame <- model21Frame[2,]

model22Frame <- data.frame(Variable = rownames(summary(mod1_limgov_open)$coef),
                           Coefficient = summary(mod1_limgov_open)$coef[, 1],
                           SE = summary(mod1_limgov_open)$coef[, 2],
                           Domain = "Limited Government")
model22Frame <- model22Frame[2,]

model23Frame <- data.frame(Variable = rownames(summary(mod1_limgov_nfc)$coef),
                           Coefficient = summary(mod1_limgov_nfc)$coef[, 1],
                           SE = summary(mod1_limgov_nfc)$coef[, 2],
                           Domain = "Limited Government")
model23Frame <- model23Frame[2,]

model24Frame <- data.frame(Variable = rownames(summary(mod1_limgov_schw)$coef),
                           Coefficient = summary(mod1_limgov_schw)$coef[, 1],
                           SE = summary(mod1_limgov_schw)$coef[, 2],
                           Domain = "Limited Government")
model24Frame <- model24Frame[2,]

model25Frame <- data.frame(Variable = rownames(summary(mod1_limgov_latent)$coef),
                           Coefficient = summary(mod1_limgov_latent)$coef[, 1],
                           SE = summary(mod1_limgov_latent)$coef[, 2],
                           Domain = "Limited Government")
model25Frame <- model25Frame[2,]

model26Frame <- data.frame(Variable = rownames(summary(mod1_imports_auth)$coef),
                           Coefficient = summary(mod1_imports_auth)$coef[, 1],
                           SE = summary(mod1_imports_auth)$coef[, 2],
                           Domain = "Free Trade")
model26Frame <- model26Frame[2,]

model27Frame <- data.frame(Variable = rownames(summary(mod1_imports_open)$coef),
                           Coefficient = summary(mod1_imports_open)$coef[, 1],
                           SE = summary(mod1_imports_open)$coef[, 2],
                           Domain = "Free Trade")
model27Frame <- model27Frame[2,]

model28Frame <- data.frame(Variable = rownames(summary(mod1_imports_nfc)$coef),
                           Coefficient = summary(mod1_imports_nfc)$coef[, 1],
                           SE = summary(mod1_imports_nfc)$coef[, 2],
                           Domain = "Free Trade")
model28Frame <- model28Frame[2,]

model29Frame <- data.frame(Variable = rownames(summary(mod1_imports_schw)$coef),
                           Coefficient = summary(mod1_imports_schw)$coef[, 1],
                           SE = summary(mod1_imports_schw)$coef[, 2],
                           Domain = "Free Trade")
model29Frame <- model29Frame[2,]

model30Frame <- data.frame(Variable = rownames(summary(mod1_imports_latent)$coef),
                           Coefficient = summary(mod1_imports_latent)$coef[, 1],
                           SE = summary(mod1_imports_latent)$coef[, 2],
                           Domain = "Free Trade")
model30Frame <- model30Frame[2,]

allModelFrame <- data.frame(rbind(model1Frame, model2Frame, model3Frame, model4Frame, model5Frame, #lr
                                  model6Frame, model7Frame, model8Frame, model9Frame, model10Frame, #cultural
                                  model11Frame, model12Frame,  model13Frame, model14Frame, model15Frame, #moral
                                  model16Frame, model17Frame, model18Frame, model19Frame, model20Frame, # econ
                                  model21Frame, model22Frame, model23Frame,  model24Frame, model25Frame, #limgov
                                  model26Frame, model27Frame, model28Frame, model29Frame, model30Frame)) # trade

allModelFrame$Domain <- factor(allModelFrame$Domain, 
                               levels = c("Left-Right Identification", "Cultural Policy", "Moral Traditionalism", "Economic Policy", "Limited Government", "Free Trade"))
allModelFrame$Variable <- factor(allModelFrame$Variable, 
                                 levels = c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"))

interval2 <- -qnorm((1-0.95)/2) # set 95% CI

zp1 <- ggplot(allModelFrame, aes(x = Domain, y = Coefficient, shape =  Variable))

zp1 <- zp1 + geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)

zp1 <- zp1 + geom_pointrange(aes(x = Domain, y = Coefficient, ymin = Coefficient - SE*interval2, 
                                 ymax = Coefficient + SE*interval2), lwd = 1/2, position = position_dodge(width = 1/2))

zp1 <- zp1 + scale_shape_manual(name = "Personality Measure", 
                                values = c(0,2,1,6,5),
                                breaks=c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"),
                                labels=c("Authoritarianism", "Openness to Experience (RC)", "Need for Closure", "Schwartz Conservation Values", "Latent Openness (RC)"))

zp1 <- zp1 + theme_bw() + theme(text=element_text(family="Times", face="bold", size=12)) +
  theme(axis.title.x = element_blank())
zp1 <- zp1  + ylim(-.35,.68)

zp1
#ggsave(file="", zp1, width = 12, height = 5) 

## Interaction Analysis ##

## Model Type 2 - OLS With Interactions Between Traits and Engagement 

# Left-Right Identification
mod2_lr_nfc <- lm(dv_lr ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_lr_open <- lm(dv_lr ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_lr_schw <- lm(dv_lr ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_lr_auth <- lm(dv_lr ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_lr_latent <- lm(dv_lr ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Economic Issue Preferences
mod2_econ_nfc <- lm(dv_econ ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_econ_open <- lm(dv_econ ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_econ_schw <- lm(dv_econ ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_econ_auth <- lm(dv_econ ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_econ_latent <- lm(dv_econ ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Social Issue Preferences
mod2_social_nfc <- lm(dv_social ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_social_open <- lm(dv_social ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_social_schw <- lm(dv_social ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_social_auth <- lm(dv_social ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_social_latent <- lm(dv_social ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Trade Imports Preferences
mod2_imports_nfc <- lm(dv_imports ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_imports_open <- lm(dv_imports ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_imports_schw <- lm(dv_imports ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_imports_auth <- lm(dv_imports ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_imports_latent <- lm(dv_imports ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Limited Government
mod2_limgov_nfc <- lm(dv_limgov ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_limgov_open <- lm(dv_limgov ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_limgov_schw <- lm(dv_limgov ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_limgov_auth <- lm(dv_limgov ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_limgov_latent <- lm(dv_limgov ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

# Moral Traditionalism
mod2_trad_nfc <- lm(dv_trad ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_trad_open <- lm(dv_trad ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_trad_schw <- lm(dv_trad ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_trad_auth <- lm(dv_trad ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)
mod2_trad_latent <- lm(dv_trad ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2018)

## Effects from 5th to 95th Percentile of Personality Type
attach(Lucid2018)

quantile(nfc_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(open_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(schw_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(auth_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(latent_scale,  probs = c(0.05, 0.95), na.rm = T)

# Left-Right Identification
lr_nfc <- post(mod2_lr_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_open <- post(mod2_lr_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_schw <- post(mod2_lr_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_auth <- post(mod2_lr_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_latent <- post(mod2_lr_latent, x1name =  "latent_scale", x1vals = c(.337,.854), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Economic Preferences
econ_nfc <- post(mod2_econ_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_open <- post(mod2_econ_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_schw <- post(mod2_econ_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_auth <- post(mod2_econ_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_latent <- post(mod2_econ_latent, x1name =  "latent_scale", x1vals = c(.337,.854), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Social Preferences
social_nfc <- post(mod2_social_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_open <- post(mod2_social_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_schw <- post(mod2_social_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_auth <- post(mod2_social_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_latent <- post(mod2_social_latent, x1name =  "latent_scale", x1vals = c(.337,.854), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Trade Import Preferences
imports_nfc <- post(mod2_imports_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_open <- post(mod2_imports_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_schw <- post(mod2_imports_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_auth <- post(mod2_imports_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_latent <- post(mod2_imports_latent, x1name =  "latent_scale", x1vals = c(.337,.854), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Limited Government Preference
limgov_nfc <- post(mod2_limgov_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_open <- post(mod2_limgov_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_schw <- post(mod2_limgov_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_auth <- post(mod2_limgov_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_latent <- post(mod2_limgov_latent, x1name =  "latent_scale", x1vals = c(.337,.854), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Moral Traditionalism Preference
trad_nfc <- post(mod2_trad_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_open <- post(mod2_trad_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_schw <- post(mod2_trad_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_auth <- post(mod2_trad_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_latent <- post(mod2_trad_latent, x1name =  "latent_scale", x1vals = c(.337,.854), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

detach(Lucid2018)

## Generate Interaction Plots for 4 Personality Measures ##

# LR-ID
#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_auth@est[3,1,1], lr_auth@est[3,1,2], lr_auth@est[3,1,3], lr_auth@est[3,1,4], lr_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_auth@est[3,2,1], lr_auth@est[3,2,2], lr_auth@est[3,2,3], lr_auth@est[3,2,4], lr_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_auth@est[3,3,1], lr_auth@est[3,3,2], lr_auth@est[3,3,3], lr_auth@est[3,3,4], lr_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_open@est[3,1,1], lr_open@est[3,1,2], lr_open@est[3,1,3], lr_open@est[3,1,4], lr_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_open@est[3,2,1], lr_open@est[3,2,2], lr_open@est[3,2,3], lr_open@est[3,2,4], lr_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_open@est[3,3,1], lr_open@est[3,3,2], lr_open@est[3,3,3], lr_open@est[3,3,4], lr_open@est[3,3,5]))
abline(h=0, lty=3)

title("Left-Right Identification", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_nfc@est[3,1,1], lr_nfc@est[3,1,2], lr_nfc@est[3,1,3], lr_nfc@est[3,1,4], lr_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_nfc@est[3,2,1], lr_nfc@est[3,2,2], lr_nfc@est[3,2,3], lr_nfc@est[3,2,4], lr_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_nfc@est[3,3,1], lr_nfc@est[3,3,2], lr_nfc@est[3,3,3], lr_nfc@est[3,3,4], lr_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_schw@est[3,1,1], lr_schw@est[3,1,2], lr_schw@est[3,1,3], lr_schw@est[3,1,4], lr_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_schw@est[3,2,1], lr_schw@est[3,2,2], lr_schw@est[3,2,3], lr_schw@est[3,2,4], lr_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_schw@est[3,3,1], lr_schw@est[3,3,2], lr_schw@est[3,3,3], lr_schw@est[3,3,4], lr_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

# Economic Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_auth@est[3,1,1], econ_auth@est[3,1,2], econ_auth@est[3,1,3], econ_auth@est[3,1,4], econ_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_auth@est[3,2,1], econ_auth@est[3,2,2], econ_auth@est[3,2,3], econ_auth@est[3,2,4], econ_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_auth@est[3,3,1], econ_auth@est[3,3,2], econ_auth@est[3,3,3], econ_auth@est[3,3,4], econ_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_open@est[3,1,1], econ_open@est[3,1,2], econ_open@est[3,1,3], econ_open@est[3,1,4], econ_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_open@est[3,2,1], econ_open@est[3,2,2], econ_open@est[3,2,3], econ_open@est[3,2,4], econ_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_open@est[3,3,1], econ_open@est[3,3,2], econ_open@est[3,3,3], econ_open@est[3,3,4], econ_open@est[3,3,5]))
abline(h=0, lty=3)

title("Economic Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_nfc@est[3,1,1], econ_nfc@est[3,1,2], econ_nfc@est[3,1,3], econ_nfc@est[3,1,4], econ_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_nfc@est[3,2,1], econ_nfc@est[3,2,2], econ_nfc@est[3,2,3], econ_nfc@est[3,2,4], econ_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_nfc@est[3,3,1], econ_nfc@est[3,3,2], econ_nfc@est[3,3,3], econ_nfc@est[3,3,4], econ_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_schw@est[3,1,1], econ_schw@est[3,1,2], econ_schw@est[3,1,3], econ_schw@est[3,1,4], econ_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_schw@est[3,2,1], econ_schw@est[3,2,2], econ_schw@est[3,2,3], econ_schw@est[3,2,4], econ_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_schw@est[3,3,1], econ_schw@est[3,3,2], econ_schw@est[3,3,3], econ_schw@est[3,3,4], econ_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Social Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_auth@est[3,1,1], social_auth@est[3,1,2], social_auth@est[3,1,3], social_auth@est[3,1,4], social_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_auth@est[3,2,1], social_auth@est[3,2,2], social_auth@est[3,2,3], social_auth@est[3,2,4], social_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_auth@est[3,3,1], social_auth@est[3,3,2], social_auth@est[3,3,3], social_auth@est[3,3,4], social_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_open@est[3,1,1], social_open@est[3,1,2], social_open@est[3,1,3], social_open@est[3,1,4], social_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_open@est[3,2,1], social_open@est[3,2,2], social_open@est[3,2,3], social_open@est[3,2,4], social_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_open@est[3,3,1], social_open@est[3,3,2], social_open@est[3,3,3], social_open@est[3,3,4], social_open@est[3,3,5]))
abline(h=0, lty=3)

title("Cultural Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_nfc@est[3,1,1], social_nfc@est[3,1,2], social_nfc@est[3,1,3], social_nfc@est[3,1,4], social_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_nfc@est[3,2,1], social_nfc@est[3,2,2], social_nfc@est[3,2,3], social_nfc@est[3,2,4], social_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_nfc@est[3,3,1], social_nfc@est[3,3,2], social_nfc@est[3,3,3], social_nfc@est[3,3,4], social_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_schw@est[3,1,1], social_schw@est[3,1,2], social_schw@est[3,1,3], social_schw@est[3,1,4], social_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_schw@est[3,2,1], social_schw@est[3,2,2], social_schw@est[3,2,3], social_schw@est[3,2,4], social_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_schw@est[3,3,1], social_schw@est[3,3,2], social_schw@est[3,3,3], social_schw@est[3,3,4], social_schw@est[3,3,5]))
abline(h=0, lty=3)


dev.off()

## Imports

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_auth@est[3,1,1], imports_auth@est[3,1,2], imports_auth@est[3,1,3], imports_auth@est[3,1,4], imports_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_auth@est[3,2,1], imports_auth@est[3,2,2], imports_auth@est[3,2,3], imports_auth@est[3,2,4], imports_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_auth@est[3,3,1], imports_auth@est[3,3,2], imports_auth@est[3,3,3], imports_auth@est[3,3,4], imports_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_open@est[3,1,1], imports_open@est[3,1,2], imports_open@est[3,1,3], imports_open@est[3,1,4], imports_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_open@est[3,2,1], imports_open@est[3,2,2], imports_open@est[3,2,3], imports_open@est[3,2,4], imports_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_open@est[3,3,1], imports_open@est[3,3,2], imports_open@est[3,3,3], imports_open@est[3,3,4], imports_open@est[3,3,5]))
abline(h=0, lty=3)

title("Free Trade Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_nfc@est[3,1,1], imports_nfc@est[3,1,2], imports_nfc@est[3,1,3], imports_nfc@est[3,1,4], imports_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_nfc@est[3,2,1], imports_nfc@est[3,2,2], imports_nfc@est[3,2,3], imports_nfc@est[3,2,4], imports_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_nfc@est[3,3,1], imports_nfc@est[3,3,2], imports_nfc@est[3,3,3], imports_nfc@est[3,3,4], imports_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_schw@est[3,1,1], imports_schw@est[3,1,2], imports_schw@est[3,1,3], imports_schw@est[3,1,4], imports_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_schw@est[3,2,1], imports_schw@est[3,2,2], imports_schw@est[3,2,3], imports_schw@est[3,2,4], imports_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_schw@est[3,3,1], imports_schw@est[3,3,2], imports_schw@est[3,3,3], imports_schw@est[3,3,4], imports_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Limited Government Index

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_auth@est[3,1,1], limgov_auth@est[3,1,2], limgov_auth@est[3,1,3], limgov_auth@est[3,1,4], limgov_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_auth@est[3,2,1], limgov_auth@est[3,2,2], limgov_auth@est[3,2,3], limgov_auth@est[3,2,4], limgov_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_auth@est[3,3,1], limgov_auth@est[3,3,2], limgov_auth@est[3,3,3], limgov_auth@est[3,3,4], limgov_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_open@est[3,1,1], limgov_open@est[3,1,2], limgov_open@est[3,1,3], limgov_open@est[3,1,4], limgov_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_open@est[3,2,1], limgov_open@est[3,2,2], limgov_open@est[3,2,3], limgov_open@est[3,2,4], limgov_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_open@est[3,3,1], limgov_open@est[3,3,2], limgov_open@est[3,3,3], limgov_open@est[3,3,4], limgov_open@est[3,3,5]))
abline(h=0, lty=3)

title("Principles of Limited Government", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_nfc@est[3,1,1], limgov_nfc@est[3,1,2], limgov_nfc@est[3,1,3], limgov_nfc@est[3,1,4], limgov_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_nfc@est[3,2,1], limgov_nfc@est[3,2,2], limgov_nfc@est[3,2,3], limgov_nfc@est[3,2,4], limgov_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_nfc@est[3,3,1], limgov_nfc@est[3,3,2], limgov_nfc@est[3,3,3], limgov_nfc@est[3,3,4], limgov_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_schw@est[3,1,1], limgov_schw@est[3,1,2], limgov_schw@est[3,1,3], limgov_schw@est[3,1,4], limgov_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_schw@est[3,2,1], limgov_schw@est[3,2,2], limgov_schw@est[3,2,3], limgov_schw@est[3,2,4], limgov_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_schw@est[3,3,1], limgov_schw@est[3,3,2], limgov_schw@est[3,3,3], limgov_schw@est[3,3,4], limgov_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Moral Traditionalism

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_auth@est[3,1,1], trad_auth@est[3,1,2], trad_auth@est[3,1,3], trad_auth@est[3,1,4], trad_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_auth@est[3,2,1], trad_auth@est[3,2,2], trad_auth@est[3,2,3], trad_auth@est[3,2,4], trad_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_auth@est[3,3,1], trad_auth@est[3,3,2], trad_auth@est[3,3,3], trad_auth@est[3,3,4], trad_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_open@est[3,1,1], trad_open@est[3,1,2], trad_open@est[3,1,3], trad_open@est[3,1,4], trad_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_open@est[3,2,1], trad_open@est[3,2,2], trad_open@est[3,2,3], trad_open@est[3,2,4], trad_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_open@est[3,3,1], trad_open@est[3,3,2], trad_open@est[3,3,3], trad_open@est[3,3,4], trad_open@est[3,3,5]))
abline(h=0, lty=3)

title("Moral Traditionalism", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_nfc@est[3,1,1], trad_nfc@est[3,1,2], trad_nfc@est[3,1,3], trad_nfc@est[3,1,4], trad_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_nfc@est[3,2,1], trad_nfc@est[3,2,2], trad_nfc@est[3,2,3], trad_nfc@est[3,2,4], trad_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_nfc@est[3,3,1], trad_nfc@est[3,3,2], trad_nfc@est[3,3,3], trad_nfc@est[3,3,4], trad_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_schw@est[3,1,1], trad_schw@est[3,1,2], trad_schw@est[3,1,3], trad_schw@est[3,1,4], trad_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_schw@est[3,2,1], trad_schw@est[3,2,2], trad_schw@est[3,2,3], trad_schw@est[3,2,4], trad_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_schw@est[3,3,1], trad_schw@est[3,3,2], trad_schw@est[3,3,3], trad_schw@est[3,3,4], trad_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## OPENNESS FIGURE ##

#jpeg(file="", type="cairo", height = 10, width = 8.5, family="sans", units = 'in', res=1800, pointsize=12)

par(mfrow=c(3,2))

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_latent@est[3,1,1], lr_latent@est[3,1,2], lr_latent@est[3,1,3], lr_latent@est[3,1,4], lr_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Left-Right Identification"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_latent@est[3,2,1], lr_latent@est[3,2,2], lr_latent@est[3,2,3], lr_latent@est[3,2,4], lr_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_latent@est[3,3,1], lr_latent@est[3,3,2], lr_latent@est[3,3,3], lr_latent@est[3,3,4], lr_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_latent@est[3,1,1], social_latent@est[3,1,2], social_latent@est[3,1,3], social_latent@est[3,1,4], social_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Cultural Policy Preferences"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_latent@est[3,2,1], social_latent@est[3,2,2], social_latent@est[3,2,3], social_latent@est[3,2,4], social_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_latent@est[3,3,1], social_latent@est[3,3,2], social_latent@est[3,3,3], social_latent@est[3,3,4], social_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_latent@est[3,1,1], trad_latent@est[3,1,2], trad_latent@est[3,1,3], trad_latent@est[3,1,4], trad_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Moral Traditionalism"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_latent@est[3,2,1], trad_latent@est[3,2,2], trad_latent@est[3,2,3], trad_latent@est[3,2,4], trad_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_latent@est[3,3,1], trad_latent@est[3,3,2], trad_latent@est[3,3,3], trad_latent@est[3,3,4], trad_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_latent@est[3,1,1], econ_latent@est[3,1,2], econ_latent@est[3,1,3], econ_latent@est[3,1,4], econ_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Economic Policy Preferences"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_latent@est[3,2,1], econ_latent@est[3,2,2], econ_latent@est[3,2,3], econ_latent@est[3,2,4], econ_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_latent@est[3,3,1], econ_latent@est[3,3,2], econ_latent@est[3,3,3], econ_latent@est[3,3,4], econ_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_latent@est[3,1,1], limgov_latent@est[3,1,2], limgov_latent@est[3,1,3], limgov_latent@est[3,1,4], limgov_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel E: Principles of Limited Government"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_latent@est[3,2,1], limgov_latent@est[3,2,2], limgov_latent@est[3,2,3], limgov_latent@est[3,2,4], limgov_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_latent@est[3,3,1], limgov_latent@est[3,3,2], limgov_latent@est[3,3,3], limgov_latent@est[3,3,4], limgov_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_latent@est[3,1,1], imports_latent@est[3,1,2], imports_latent@est[3,1,3], imports_latent@est[3,1,4], imports_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.40,.45), 
     xlim=c(0,1))
title(main=list("Panel F: Free Trade Preferences"))
axis(2, at=c(-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_latent@est[3,2,1], imports_latent@est[3,2,2], imports_latent@est[3,2,3], imports_latent@est[3,2,4], imports_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_latent@est[3,3,1], imports_latent@est[3,3,2], imports_latent@est[3,3,3], imports_latent@est[3,3,4], imports_latent@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

##### Figures 5G, 5H, and 5I #####

Lucid2019 <- Replication[Replication$year == 2019,]

## Model Type 1 - OLS, No Interactions Between Traits and Engagement 

# Left-Right Identification
mod1_lr_nfc <- lm(dv_lr ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_lr_open <- lm(dv_lr ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_lr_schw <- lm(dv_lr ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_lr_auth <- lm(dv_lr ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_lr_latent <- lm(dv_lr ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Economic Issue Preferences
mod1_econ_nfc <- lm(dv_econ ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_econ_open <- lm(dv_econ ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_econ_schw <- lm(dv_econ ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_econ_auth <- lm(dv_econ ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_econ_latent <- lm(dv_econ ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Social Issue Preferences
mod1_social_nfc <- lm(dv_social ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_social_open <- lm(dv_social ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_social_schw <- lm(dv_social ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_social_auth <- lm(dv_social ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_social_latent <- lm(dv_social ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Trade Issue Preferences
mod1_imports_nfc <- lm(dv_imports ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_imports_open <- lm(dv_imports ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_imports_schw <- lm(dv_imports ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_imports_auth <- lm(dv_imports ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_imports_latent <- lm(dv_imports ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Limited Government 
mod1_limgov_nfc <- lm(dv_limgov ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_limgov_open <- lm(dv_limgov ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_limgov_schw <- lm(dv_limgov ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_limgov_auth <- lm(dv_limgov ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_limgov_latent <- lm(dv_limgov ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Moral Traditionalism
mod1_trad_nfc <- lm(dv_trad ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_trad_open <- lm(dv_trad ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_trad_schw <- lm(dv_trad ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_trad_auth <- lm(dv_trad ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod1_trad_latent <- lm(dv_trad ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

## Put Parameters/Errors in Data Frame ##

model1Frame <- data.frame(Variable = rownames(summary(mod1_lr_auth)$coef),
                          Coefficient = summary(mod1_lr_auth)$coef[, 1],
                          SE = summary(mod1_lr_auth)$coef[, 2],
                          Domain = "Left-Right Identification")
model1Frame <- model1Frame[2,]

model2Frame <- data.frame(Variable = rownames(summary(mod1_lr_open)$coef),
                          Coefficient = summary(mod1_lr_open)$coef[, 1],
                          SE = summary(mod1_lr_open)$coef[, 2],
                          Domain = "Left-Right Identification")
model2Frame <- model2Frame[2,]

model3Frame <- data.frame(Variable = rownames(summary(mod1_lr_nfc)$coef),
                          Coefficient = summary(mod1_lr_nfc)$coef[, 1],
                          SE = summary(mod1_lr_nfc)$coef[, 2],
                          Domain = "Left-Right Identification")
model3Frame <- model3Frame[2,]

model4Frame <- data.frame(Variable = rownames(summary(mod1_lr_schw)$coef),
                          Coefficient = summary(mod1_lr_schw)$coef[, 1],
                          SE = summary(mod1_lr_schw)$coef[, 2],
                          Domain = "Left-Right Identification")
model4Frame <- model4Frame[2,]

model5Frame <- data.frame(Variable = rownames(summary(mod1_lr_latent)$coef),
                          Coefficient = summary(mod1_lr_latent)$coef[, 1],
                          SE = summary(mod1_lr_latent)$coef[, 2],
                          Domain = "Left-Right Identification")
model5Frame <- model5Frame[2,]

model6Frame <- data.frame(Variable = rownames(summary(mod1_social_auth)$coef),
                          Coefficient = summary(mod1_social_auth)$coef[, 1],
                          SE = summary(mod1_social_auth)$coef[, 2],
                          Domain = "Cultural Policy")
model6Frame <- model6Frame[2,]

model7Frame <- data.frame(Variable = rownames(summary(mod1_social_open)$coef),
                          Coefficient = summary(mod1_social_open)$coef[, 1],
                          SE = summary(mod1_social_open)$coef[, 2],
                          Domain = "Cultural Policy")
model7Frame <- model7Frame[2,]

model8Frame <- data.frame(Variable = rownames(summary(mod1_social_nfc)$coef),
                          Coefficient = summary(mod1_social_nfc)$coef[, 1],
                          SE = summary(mod1_social_nfc)$coef[, 2],
                          Domain = "Cultural Policy")
model8Frame <- model8Frame[2,]

model9Frame <- data.frame(Variable = rownames(summary(mod1_social_schw)$coef),
                          Coefficient = summary(mod1_social_schw)$coef[, 1],
                          SE = summary(mod1_social_schw)$coef[, 2],
                          Domain = "Cultural Policy")
model9Frame <- model9Frame[2,]

model10Frame <- data.frame(Variable = rownames(summary(mod1_social_latent)$coef),
                           Coefficient = summary(mod1_social_latent)$coef[, 1],
                           SE = summary(mod1_social_latent)$coef[, 2],
                           Domain = "Cultural Policy")
model10Frame <- model10Frame[2,]

model11Frame <- data.frame(Variable = rownames(summary(mod1_trad_auth)$coef),
                           Coefficient = summary(mod1_trad_auth)$coef[, 1],
                           SE = summary(mod1_trad_auth)$coef[, 2],
                           Domain = "Moral Traditionalism")
model11Frame <- model11Frame[2,]

model12Frame <- data.frame(Variable = rownames(summary(mod1_trad_open)$coef),
                           Coefficient = summary(mod1_trad_open)$coef[, 1],
                           SE = summary(mod1_trad_open)$coef[, 2],
                           Domain = "Moral Traditionalism")
model12Frame <- model12Frame[2,]

model13Frame <- data.frame(Variable = rownames(summary(mod1_trad_nfc)$coef),
                           Coefficient = summary(mod1_trad_nfc)$coef[, 1],
                           SE = summary(mod1_trad_nfc)$coef[, 2],
                           Domain = "Moral Traditionalism")
model13Frame <- model13Frame[2,]

model14Frame <- data.frame(Variable = rownames(summary(mod1_trad_schw)$coef),
                           Coefficient = summary(mod1_trad_schw)$coef[, 1],
                           SE = summary(mod1_trad_schw)$coef[, 2],
                           Domain = "Moral Traditionalism")
model14Frame <- model14Frame[2,]

model15Frame <- data.frame(Variable = rownames(summary(mod1_trad_latent)$coef),
                           Coefficient = summary(mod1_trad_latent)$coef[, 1],
                           SE = summary(mod1_trad_latent)$coef[, 2],
                           Domain = "Moral Traditionalism")
model15Frame <- model15Frame[2,]

model16Frame <- data.frame(Variable = rownames(summary(mod1_econ_auth)$coef),
                           Coefficient = summary(mod1_econ_auth)$coef[, 1],
                           SE = summary(mod1_econ_auth)$coef[, 2],
                           Domain = "Economic Policy")
model16Frame <- model16Frame[2,]

model17Frame <- data.frame(Variable = rownames(summary(mod1_econ_open)$coef),
                           Coefficient = summary(mod1_econ_open)$coef[, 1],
                           SE = summary(mod1_econ_open)$coef[, 2],
                           Domain = "Economic Policy")
model17Frame <- model17Frame[2,]

model18Frame <- data.frame(Variable = rownames(summary(mod1_econ_nfc)$coef),
                           Coefficient = summary(mod1_econ_nfc)$coef[, 1],
                           SE = summary(mod1_econ_nfc)$coef[, 2],
                           Domain = "Economic Policy")
model18Frame <- model18Frame[2,]

model19Frame <- data.frame(Variable = rownames(summary(mod1_econ_schw)$coef),
                           Coefficient = summary(mod1_econ_schw)$coef[, 1],
                           SE = summary(mod1_econ_schw)$coef[, 2],
                           Domain = "Economic Policy")
model19Frame <- model19Frame[2,]

model20Frame <- data.frame(Variable = rownames(summary(mod1_econ_latent)$coef),
                           Coefficient = summary(mod1_econ_latent)$coef[, 1],
                           SE = summary(mod1_econ_latent)$coef[, 2],
                           Domain = "Economic Policy")
model20Frame <- model20Frame[2,]

model21Frame <- data.frame(Variable = rownames(summary(mod1_limgov_auth)$coef),
                           Coefficient = summary(mod1_limgov_auth)$coef[, 1],
                           SE = summary(mod1_limgov_auth)$coef[, 2],
                           Domain = "Limited Government")
model21Frame <- model21Frame[2,]

model22Frame <- data.frame(Variable = rownames(summary(mod1_limgov_open)$coef),
                           Coefficient = summary(mod1_limgov_open)$coef[, 1],
                           SE = summary(mod1_limgov_open)$coef[, 2],
                           Domain = "Limited Government")
model22Frame <- model22Frame[2,]

model23Frame <- data.frame(Variable = rownames(summary(mod1_limgov_nfc)$coef),
                           Coefficient = summary(mod1_limgov_nfc)$coef[, 1],
                           SE = summary(mod1_limgov_nfc)$coef[, 2],
                           Domain = "Limited Government")
model23Frame <- model23Frame[2,]

model24Frame <- data.frame(Variable = rownames(summary(mod1_limgov_schw)$coef),
                           Coefficient = summary(mod1_limgov_schw)$coef[, 1],
                           SE = summary(mod1_limgov_schw)$coef[, 2],
                           Domain = "Limited Government")
model24Frame <- model24Frame[2,]

model25Frame <- data.frame(Variable = rownames(summary(mod1_limgov_latent)$coef),
                           Coefficient = summary(mod1_limgov_latent)$coef[, 1],
                           SE = summary(mod1_limgov_latent)$coef[, 2],
                           Domain = "Limited Government")
model25Frame <- model25Frame[2,]

model26Frame <- data.frame(Variable = rownames(summary(mod1_imports_auth)$coef),
                           Coefficient = summary(mod1_imports_auth)$coef[, 1],
                           SE = summary(mod1_imports_auth)$coef[, 2],
                           Domain = "Free Trade")
model26Frame <- model26Frame[2,]

model27Frame <- data.frame(Variable = rownames(summary(mod1_imports_open)$coef),
                           Coefficient = summary(mod1_imports_open)$coef[, 1],
                           SE = summary(mod1_imports_open)$coef[, 2],
                           Domain = "Free Trade")
model27Frame <- model27Frame[2,]

model28Frame <- data.frame(Variable = rownames(summary(mod1_imports_nfc)$coef),
                           Coefficient = summary(mod1_imports_nfc)$coef[, 1],
                           SE = summary(mod1_imports_nfc)$coef[, 2],
                           Domain = "Free Trade")
model28Frame <- model28Frame[2,]

model29Frame <- data.frame(Variable = rownames(summary(mod1_imports_schw)$coef),
                           Coefficient = summary(mod1_imports_schw)$coef[, 1],
                           SE = summary(mod1_imports_schw)$coef[, 2],
                           Domain = "Free Trade")
model29Frame <- model29Frame[2,]

model30Frame <- data.frame(Variable = rownames(summary(mod1_imports_latent)$coef),
                           Coefficient = summary(mod1_imports_latent)$coef[, 1],
                           SE = summary(mod1_imports_latent)$coef[, 2],
                           Domain = "Free Trade")
model30Frame <- model30Frame[2,]

allModelFrame <- data.frame(rbind(model1Frame, model2Frame, model3Frame, model4Frame, model5Frame, #lr
                                  model6Frame, model7Frame, model8Frame, model9Frame, model10Frame, #cultural
                                  model11Frame, model12Frame,  model13Frame, model14Frame, model15Frame, #moral
                                  model16Frame, model17Frame, model18Frame, model19Frame, model20Frame, # econ
                                  model21Frame, model22Frame, model23Frame,  model24Frame, model25Frame, #limgov
                                  model26Frame, model27Frame, model28Frame, model29Frame, model30Frame)) # trade

allModelFrame$Domain <- factor(allModelFrame$Domain, 
                               levels = c("Left-Right Identification", "Cultural Policy", "Moral Traditionalism", "Economic Policy", "Limited Government", "Free Trade"))
allModelFrame$Variable <- factor(allModelFrame$Variable, 
                                 levels = c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"))

interval2 <- -qnorm((1-0.95)/2) # set 95% CI

zp1 <- ggplot(allModelFrame, aes(x = Domain, y = Coefficient, shape =  Variable))

zp1 <- zp1 + geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)

zp1 <- zp1 + geom_pointrange(aes(x = Domain, y = Coefficient, ymin = Coefficient - SE*interval2, 
                                 ymax = Coefficient + SE*interval2), lwd = 1/2, position = position_dodge(width = 1/2))

zp1 <- zp1 + scale_shape_manual(name = "Personality Measure", 
                                values = c(0,2,1,6,5),
                                breaks=c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"),
                                labels=c("Authoritarianism", "Openness to Experience (RC)", "Need for Closure", "Schwartz Conservation Values", "Latent Openness (RC)"))

zp1 <- zp1 + theme_bw() + theme(text=element_text(family="Times", face="bold", size=12)) +
  theme(axis.title.x = element_blank())
zp1 <- zp1  + ylim(-.35,.50)

zp1
#ggsave(file="", zp1, width = 12, height = 5) 

## Interaction Analysis ##

## Model Type 2 - OLS With Interactions Between Traits and Engagement 

# Left-Right Identification
mod2_lr_nfc <- lm(dv_lr ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_lr_open <- lm(dv_lr ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_lr_schw <- lm(dv_lr ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_lr_auth <- lm(dv_lr ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_lr_latent <- lm(dv_lr ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Economic Issue Preferences
mod2_econ_nfc <- lm(dv_econ ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_econ_open <- lm(dv_econ ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_econ_schw <- lm(dv_econ ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_econ_auth <- lm(dv_econ ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_econ_latent <- lm(dv_econ ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Social Issue Preferences
mod2_social_nfc <- lm(dv_social ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_social_open <- lm(dv_social ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_social_schw <- lm(dv_social ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_social_auth <- lm(dv_social ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_social_latent <- lm(dv_social ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Trade Imports Preferences
mod2_imports_nfc <- lm(dv_imports ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_imports_open <- lm(dv_imports ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_imports_schw <- lm(dv_imports ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_imports_auth <- lm(dv_imports ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_imports_latent <- lm(dv_imports ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Limited Government
mod2_limgov_nfc <- lm(dv_limgov ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_limgov_open <- lm(dv_limgov ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_limgov_schw <- lm(dv_limgov ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_limgov_auth <- lm(dv_limgov ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_limgov_latent <- lm(dv_limgov ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

# Moral Traditionalism
mod2_trad_nfc <- lm(dv_trad ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_trad_open <- lm(dv_trad ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_trad_schw <- lm(dv_trad ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_trad_auth <- lm(dv_trad ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)
mod2_trad_latent <- lm(dv_trad ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2019)

## Effects from 5th to 95th Percentile of Personality Type
attach(Lucid2019)

quantile(nfc_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(open_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(schw_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(auth_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(latent_scale,  probs = c(0.05, 0.95), na.rm = T)

# Left-Right Identification
lr_nfc <- post(mod2_lr_nfc, x1name =  "nfc_scale", x1vals = c(.34,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_open <- post(mod2_lr_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_schw <- post(mod2_lr_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_auth <- post(mod2_lr_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_latent <- post(mod2_lr_latent, x1name =  "latent_scale", x1vals = c(.331,.873), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Economic Preferences
econ_nfc <- post(mod2_econ_nfc, x1name =  "nfc_scale", x1vals = c(.34,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_open <- post(mod2_econ_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_schw <- post(mod2_econ_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_auth <- post(mod2_econ_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_latent <- post(mod2_econ_latent, x1name =  "latent_scale", x1vals = c(.331,.873), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Social Preferences
social_nfc <- post(mod2_social_nfc, x1name =  "nfc_scale", x1vals = c(.34,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_open <- post(mod2_social_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_schw <- post(mod2_social_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_auth <- post(mod2_social_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_latent <- post(mod2_social_latent, x1name =  "latent_scale", x1vals = c(.331,.873), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Trade Import Preferences
imports_nfc <- post(mod2_imports_nfc, x1name =  "nfc_scale", x1vals = c(.34,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_open <- post(mod2_imports_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_schw <- post(mod2_imports_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_auth <- post(mod2_imports_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_latent <- post(mod2_imports_latent, x1name =  "latent_scale", x1vals = c(.331,.873), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Limited Government Preference
limgov_nfc <- post(mod2_limgov_nfc, x1name =  "nfc_scale", x1vals = c(.34,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_open <- post(mod2_limgov_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_schw <- post(mod2_limgov_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_auth <- post(mod2_limgov_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_latent <- post(mod2_limgov_latent, x1name =  "latent_scale", x1vals = c(.331,.873), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Moral Traditionalism Preference
trad_nfc <- post(mod2_trad_nfc, x1name =  "nfc_scale", x1vals = c(.34,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_open <- post(mod2_trad_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_schw <- post(mod2_trad_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_auth <- post(mod2_trad_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_latent <- post(mod2_trad_latent, x1name =  "latent_scale", x1vals = c(.331,.873), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

detach(Lucid2019)

## Generate Interaction Plots for 4 Personality Measures ##

# LR-ID
#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_auth@est[3,1,1], lr_auth@est[3,1,2], lr_auth@est[3,1,3], lr_auth@est[3,1,4], lr_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_auth@est[3,2,1], lr_auth@est[3,2,2], lr_auth@est[3,2,3], lr_auth@est[3,2,4], lr_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_auth@est[3,3,1], lr_auth@est[3,3,2], lr_auth@est[3,3,3], lr_auth@est[3,3,4], lr_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_open@est[3,1,1], lr_open@est[3,1,2], lr_open@est[3,1,3], lr_open@est[3,1,4], lr_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_open@est[3,2,1], lr_open@est[3,2,2], lr_open@est[3,2,3], lr_open@est[3,2,4], lr_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_open@est[3,3,1], lr_open@est[3,3,2], lr_open@est[3,3,3], lr_open@est[3,3,4], lr_open@est[3,3,5]))
abline(h=0, lty=3)

title("Left-Right Identification", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_nfc@est[3,1,1], lr_nfc@est[3,1,2], lr_nfc@est[3,1,3], lr_nfc@est[3,1,4], lr_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_nfc@est[3,2,1], lr_nfc@est[3,2,2], lr_nfc@est[3,2,3], lr_nfc@est[3,2,4], lr_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_nfc@est[3,3,1], lr_nfc@est[3,3,2], lr_nfc@est[3,3,3], lr_nfc@est[3,3,4], lr_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_schw@est[3,1,1], lr_schw@est[3,1,2], lr_schw@est[3,1,3], lr_schw@est[3,1,4], lr_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_schw@est[3,2,1], lr_schw@est[3,2,2], lr_schw@est[3,2,3], lr_schw@est[3,2,4], lr_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_schw@est[3,3,1], lr_schw@est[3,3,2], lr_schw@est[3,3,3], lr_schw@est[3,3,4], lr_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

# Economic Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_auth@est[3,1,1], econ_auth@est[3,1,2], econ_auth@est[3,1,3], econ_auth@est[3,1,4], econ_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_auth@est[3,2,1], econ_auth@est[3,2,2], econ_auth@est[3,2,3], econ_auth@est[3,2,4], econ_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_auth@est[3,3,1], econ_auth@est[3,3,2], econ_auth@est[3,3,3], econ_auth@est[3,3,4], econ_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_open@est[3,1,1], econ_open@est[3,1,2], econ_open@est[3,1,3], econ_open@est[3,1,4], econ_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_open@est[3,2,1], econ_open@est[3,2,2], econ_open@est[3,2,3], econ_open@est[3,2,4], econ_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_open@est[3,3,1], econ_open@est[3,3,2], econ_open@est[3,3,3], econ_open@est[3,3,4], econ_open@est[3,3,5]))
abline(h=0, lty=3)

title("Economic Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_nfc@est[3,1,1], econ_nfc@est[3,1,2], econ_nfc@est[3,1,3], econ_nfc@est[3,1,4], econ_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_nfc@est[3,2,1], econ_nfc@est[3,2,2], econ_nfc@est[3,2,3], econ_nfc@est[3,2,4], econ_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_nfc@est[3,3,1], econ_nfc@est[3,3,2], econ_nfc@est[3,3,3], econ_nfc@est[3,3,4], econ_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_schw@est[3,1,1], econ_schw@est[3,1,2], econ_schw@est[3,1,3], econ_schw@est[3,1,4], econ_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_schw@est[3,2,1], econ_schw@est[3,2,2], econ_schw@est[3,2,3], econ_schw@est[3,2,4], econ_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_schw@est[3,3,1], econ_schw@est[3,3,2], econ_schw@est[3,3,3], econ_schw@est[3,3,4], econ_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Social Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_auth@est[3,1,1], social_auth@est[3,1,2], social_auth@est[3,1,3], social_auth@est[3,1,4], social_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_auth@est[3,2,1], social_auth@est[3,2,2], social_auth@est[3,2,3], social_auth@est[3,2,4], social_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_auth@est[3,3,1], social_auth@est[3,3,2], social_auth@est[3,3,3], social_auth@est[3,3,4], social_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_open@est[3,1,1], social_open@est[3,1,2], social_open@est[3,1,3], social_open@est[3,1,4], social_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_open@est[3,2,1], social_open@est[3,2,2], social_open@est[3,2,3], social_open@est[3,2,4], social_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_open@est[3,3,1], social_open@est[3,3,2], social_open@est[3,3,3], social_open@est[3,3,4], social_open@est[3,3,5]))
abline(h=0, lty=3)

title("Cultural Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_nfc@est[3,1,1], social_nfc@est[3,1,2], social_nfc@est[3,1,3], social_nfc@est[3,1,4], social_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_nfc@est[3,2,1], social_nfc@est[3,2,2], social_nfc@est[3,2,3], social_nfc@est[3,2,4], social_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_nfc@est[3,3,1], social_nfc@est[3,3,2], social_nfc@est[3,3,3], social_nfc@est[3,3,4], social_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_schw@est[3,1,1], social_schw@est[3,1,2], social_schw@est[3,1,3], social_schw@est[3,1,4], social_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_schw@est[3,2,1], social_schw@est[3,2,2], social_schw@est[3,2,3], social_schw@est[3,2,4], social_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_schw@est[3,3,1], social_schw@est[3,3,2], social_schw@est[3,3,3], social_schw@est[3,3,4], social_schw@est[3,3,5]))
abline(h=0, lty=3)


dev.off()

## Imports

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_auth@est[3,1,1], imports_auth@est[3,1,2], imports_auth@est[3,1,3], imports_auth@est[3,1,4], imports_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_auth@est[3,2,1], imports_auth@est[3,2,2], imports_auth@est[3,2,3], imports_auth@est[3,2,4], imports_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_auth@est[3,3,1], imports_auth@est[3,3,2], imports_auth@est[3,3,3], imports_auth@est[3,3,4], imports_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_open@est[3,1,1], imports_open@est[3,1,2], imports_open@est[3,1,3], imports_open@est[3,1,4], imports_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_open@est[3,2,1], imports_open@est[3,2,2], imports_open@est[3,2,3], imports_open@est[3,2,4], imports_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_open@est[3,3,1], imports_open@est[3,3,2], imports_open@est[3,3,3], imports_open@est[3,3,4], imports_open@est[3,3,5]))
abline(h=0, lty=3)

title("Free Trade Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_nfc@est[3,1,1], imports_nfc@est[3,1,2], imports_nfc@est[3,1,3], imports_nfc@est[3,1,4], imports_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_nfc@est[3,2,1], imports_nfc@est[3,2,2], imports_nfc@est[3,2,3], imports_nfc@est[3,2,4], imports_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_nfc@est[3,3,1], imports_nfc@est[3,3,2], imports_nfc@est[3,3,3], imports_nfc@est[3,3,4], imports_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_schw@est[3,1,1], imports_schw@est[3,1,2], imports_schw@est[3,1,3], imports_schw@est[3,1,4], imports_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_schw@est[3,2,1], imports_schw@est[3,2,2], imports_schw@est[3,2,3], imports_schw@est[3,2,4], imports_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_schw@est[3,3,1], imports_schw@est[3,3,2], imports_schw@est[3,3,3], imports_schw@est[3,3,4], imports_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Limited Government Index

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_auth@est[3,1,1], limgov_auth@est[3,1,2], limgov_auth@est[3,1,3], limgov_auth@est[3,1,4], limgov_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.70,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.70,-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_auth@est[3,2,1], limgov_auth@est[3,2,2], limgov_auth@est[3,2,3], limgov_auth@est[3,2,4], limgov_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_auth@est[3,3,1], limgov_auth@est[3,3,2], limgov_auth@est[3,3,3], limgov_auth@est[3,3,4], limgov_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_open@est[3,1,1], limgov_open@est[3,1,2], limgov_open@est[3,1,3], limgov_open@est[3,1,4], limgov_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_open@est[3,2,1], limgov_open@est[3,2,2], limgov_open@est[3,2,3], limgov_open@est[3,2,4], limgov_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_open@est[3,3,1], limgov_open@est[3,3,2], limgov_open@est[3,3,3], limgov_open@est[3,3,4], limgov_open@est[3,3,5]))
abline(h=0, lty=3)

title("Principles of Limited Government", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_nfc@est[3,1,1], limgov_nfc@est[3,1,2], limgov_nfc@est[3,1,3], limgov_nfc@est[3,1,4], limgov_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_nfc@est[3,2,1], limgov_nfc@est[3,2,2], limgov_nfc@est[3,2,3], limgov_nfc@est[3,2,4], limgov_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_nfc@est[3,3,1], limgov_nfc@est[3,3,2], limgov_nfc@est[3,3,3], limgov_nfc@est[3,3,4], limgov_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_schw@est[3,1,1], limgov_schw@est[3,1,2], limgov_schw@est[3,1,3], limgov_schw@est[3,1,4], limgov_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_schw@est[3,2,1], limgov_schw@est[3,2,2], limgov_schw@est[3,2,3], limgov_schw@est[3,2,4], limgov_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_schw@est[3,3,1], limgov_schw@est[3,3,2], limgov_schw@est[3,3,3], limgov_schw@est[3,3,4], limgov_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Moral Traditionalism

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_auth@est[3,1,1], trad_auth@est[3,1,2], trad_auth@est[3,1,3], trad_auth@est[3,1,4], trad_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_auth@est[3,2,1], trad_auth@est[3,2,2], trad_auth@est[3,2,3], trad_auth@est[3,2,4], trad_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_auth@est[3,3,1], trad_auth@est[3,3,2], trad_auth@est[3,3,3], trad_auth@est[3,3,4], trad_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_open@est[3,1,1], trad_open@est[3,1,2], trad_open@est[3,1,3], trad_open@est[3,1,4], trad_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_open@est[3,2,1], trad_open@est[3,2,2], trad_open@est[3,2,3], trad_open@est[3,2,4], trad_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_open@est[3,3,1], trad_open@est[3,3,2], trad_open@est[3,3,3], trad_open@est[3,3,4], trad_open@est[3,3,5]))
abline(h=0, lty=3)

title("Moral Traditionalism", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_nfc@est[3,1,1], trad_nfc@est[3,1,2], trad_nfc@est[3,1,3], trad_nfc@est[3,1,4], trad_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_nfc@est[3,2,1], trad_nfc@est[3,2,2], trad_nfc@est[3,2,3], trad_nfc@est[3,2,4], trad_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_nfc@est[3,3,1], trad_nfc@est[3,3,2], trad_nfc@est[3,3,3], trad_nfc@est[3,3,4], trad_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_schw@est[3,1,1], trad_schw@est[3,1,2], trad_schw@est[3,1,3], trad_schw@est[3,1,4], trad_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_schw@est[3,2,1], trad_schw@est[3,2,2], trad_schw@est[3,2,3], trad_schw@est[3,2,4], trad_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_schw@est[3,3,1], trad_schw@est[3,3,2], trad_schw@est[3,3,3], trad_schw@est[3,3,4], trad_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## OPENNESS FIGURE ##

#jpeg(file="", type="cairo", height = 10, width = 8.5, family="sans", units = 'in', res=1800, pointsize=12)

par(mfrow=c(3,2))

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_latent@est[3,1,1], lr_latent@est[3,1,2], lr_latent@est[3,1,3], lr_latent@est[3,1,4], lr_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Left-Right Identification"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_latent@est[3,2,1], lr_latent@est[3,2,2], lr_latent@est[3,2,3], lr_latent@est[3,2,4], lr_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_latent@est[3,3,1], lr_latent@est[3,3,2], lr_latent@est[3,3,3], lr_latent@est[3,3,4], lr_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_latent@est[3,1,1], social_latent@est[3,1,2], social_latent@est[3,1,3], social_latent@est[3,1,4], social_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Cultural Policy Preferences"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_latent@est[3,2,1], social_latent@est[3,2,2], social_latent@est[3,2,3], social_latent@est[3,2,4], social_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_latent@est[3,3,1], social_latent@est[3,3,2], social_latent@est[3,3,3], social_latent@est[3,3,4], social_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_latent@est[3,1,1], trad_latent@est[3,1,2], trad_latent@est[3,1,3], trad_latent@est[3,1,4], trad_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Moral Traditionalism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_latent@est[3,2,1], trad_latent@est[3,2,2], trad_latent@est[3,2,3], trad_latent@est[3,2,4], trad_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_latent@est[3,3,1], trad_latent@est[3,3,2], trad_latent@est[3,3,3], trad_latent@est[3,3,4], trad_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_latent@est[3,1,1], econ_latent@est[3,1,2], econ_latent@est[3,1,3], econ_latent@est[3,1,4], econ_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Economic Policy Preferences"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_latent@est[3,2,1], econ_latent@est[3,2,2], econ_latent@est[3,2,3], econ_latent@est[3,2,4], econ_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_latent@est[3,3,1], econ_latent@est[3,3,2], econ_latent@est[3,3,3], econ_latent@est[3,3,4], econ_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_latent@est[3,1,1], limgov_latent@est[3,1,2], limgov_latent@est[3,1,3], limgov_latent@est[3,1,4], limgov_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel E: Principles of Limited Government"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_latent@est[3,2,1], limgov_latent@est[3,2,2], limgov_latent@est[3,2,3], limgov_latent@est[3,2,4], limgov_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_latent@est[3,3,1], limgov_latent@est[3,3,2], limgov_latent@est[3,3,3], limgov_latent@est[3,3,4], limgov_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_latent@est[3,1,1], imports_latent@est[3,1,2], imports_latent@est[3,1,3], imports_latent@est[3,1,4], imports_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel F: Free Trade Preferences"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_latent@est[3,2,1], imports_latent@est[3,2,2], imports_latent@est[3,2,3], imports_latent@est[3,2,4], imports_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_latent@est[3,3,1], imports_latent@est[3,3,2], imports_latent@est[3,3,3], imports_latent@est[3,3,4], imports_latent@est[3,3,5]))
abline(h=0, lty=3)

dev.off()




##### Figures 5J, 5K, and 5L #####

Lucid2020 <- Replication[Replication$year == 2020,]

## No-Interaction Analysis ##

# Left-Right Identification
mod1_lr_nfc <- lm(dv_lr ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_lr_open <- lm(dv_lr ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_lr_schw <- lm(dv_lr ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_lr_auth <- lm(dv_lr ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_lr_latent <- lm(dv_lr ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Economic Issue Preferences
mod1_econ_nfc <- lm(dv_econ ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_econ_open <- lm(dv_econ ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_econ_schw <- lm(dv_econ ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_econ_auth <- lm(dv_econ ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_econ_latent <- lm(dv_econ ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Social Issue Preferences
mod1_social_nfc <- lm(dv_social ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_social_open <- lm(dv_social ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_social_schw <- lm(dv_social ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_social_auth <- lm(dv_social ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_social_latent <- lm(dv_social ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Trade Issue Preferences
mod1_imports_nfc <- lm(dv_imports ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_imports_open <- lm(dv_imports ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_imports_schw <- lm(dv_imports ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_imports_auth <- lm(dv_imports ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_imports_latent <- lm(dv_imports ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Limited Government 
mod1_limgov_nfc <- lm(dv_limgov ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_limgov_open <- lm(dv_limgov ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_limgov_schw <- lm(dv_limgov ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_limgov_auth <- lm(dv_limgov ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_limgov_latent <- lm(dv_limgov ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Moral Traditionalism
mod1_trad_nfc <- lm(dv_trad ~ nfc_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_trad_open <- lm(dv_trad ~ open_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_trad_schw <- lm(dv_trad ~ schw_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_trad_auth <- lm(dv_trad ~ auth_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod1_trad_latent <- lm(dv_trad ~ latent_scale + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

## Put Parameters/Errors in Data Frame ##

model1Frame <- data.frame(Variable = rownames(summary(mod1_lr_auth)$coef),
                          Coefficient = summary(mod1_lr_auth)$coef[, 1],
                          SE = summary(mod1_lr_auth)$coef[, 2],
                          Domain = "Left-Right Identification")
model1Frame <- model1Frame[2,]

model2Frame <- data.frame(Variable = rownames(summary(mod1_lr_open)$coef),
                          Coefficient = summary(mod1_lr_open)$coef[, 1],
                          SE = summary(mod1_lr_open)$coef[, 2],
                          Domain = "Left-Right Identification")
model2Frame <- model2Frame[2,]

model3Frame <- data.frame(Variable = rownames(summary(mod1_lr_nfc)$coef),
                          Coefficient = summary(mod1_lr_nfc)$coef[, 1],
                          SE = summary(mod1_lr_nfc)$coef[, 2],
                          Domain = "Left-Right Identification")
model3Frame <- model3Frame[2,]

model4Frame <- data.frame(Variable = rownames(summary(mod1_lr_schw)$coef),
                          Coefficient = summary(mod1_lr_schw)$coef[, 1],
                          SE = summary(mod1_lr_schw)$coef[, 2],
                          Domain = "Left-Right Identification")
model4Frame <- model4Frame[2,]

model5Frame <- data.frame(Variable = rownames(summary(mod1_lr_latent)$coef),
                          Coefficient = summary(mod1_lr_latent)$coef[, 1],
                          SE = summary(mod1_lr_latent)$coef[, 2],
                          Domain = "Left-Right Identification")
model5Frame <- model5Frame[2,]

model6Frame <- data.frame(Variable = rownames(summary(mod1_social_auth)$coef),
                          Coefficient = summary(mod1_social_auth)$coef[, 1],
                          SE = summary(mod1_social_auth)$coef[, 2],
                          Domain = "Cultural Policy")
model6Frame <- model6Frame[2,]

model7Frame <- data.frame(Variable = rownames(summary(mod1_social_open)$coef),
                          Coefficient = summary(mod1_social_open)$coef[, 1],
                          SE = summary(mod1_social_open)$coef[, 2],
                          Domain = "Cultural Policy")
model7Frame <- model7Frame[2,]

model8Frame <- data.frame(Variable = rownames(summary(mod1_social_nfc)$coef),
                          Coefficient = summary(mod1_social_nfc)$coef[, 1],
                          SE = summary(mod1_social_nfc)$coef[, 2],
                          Domain = "Cultural Policy")
model8Frame <- model8Frame[2,]

model9Frame <- data.frame(Variable = rownames(summary(mod1_social_schw)$coef),
                          Coefficient = summary(mod1_social_schw)$coef[, 1],
                          SE = summary(mod1_social_schw)$coef[, 2],
                          Domain = "Cultural Policy")
model9Frame <- model9Frame[2,]

model10Frame <- data.frame(Variable = rownames(summary(mod1_social_latent)$coef),
                           Coefficient = summary(mod1_social_latent)$coef[, 1],
                           SE = summary(mod1_social_latent)$coef[, 2],
                           Domain = "Cultural Policy")
model10Frame <- model10Frame[2,]

model11Frame <- data.frame(Variable = rownames(summary(mod1_trad_auth)$coef),
                           Coefficient = summary(mod1_trad_auth)$coef[, 1],
                           SE = summary(mod1_trad_auth)$coef[, 2],
                           Domain = "Moral Traditionalism")
model11Frame <- model11Frame[2,]

model12Frame <- data.frame(Variable = rownames(summary(mod1_trad_open)$coef),
                           Coefficient = summary(mod1_trad_open)$coef[, 1],
                           SE = summary(mod1_trad_open)$coef[, 2],
                           Domain = "Moral Traditionalism")
model12Frame <- model12Frame[2,]

model13Frame <- data.frame(Variable = rownames(summary(mod1_trad_nfc)$coef),
                           Coefficient = summary(mod1_trad_nfc)$coef[, 1],
                           SE = summary(mod1_trad_nfc)$coef[, 2],
                           Domain = "Moral Traditionalism")
model13Frame <- model13Frame[2,]

model14Frame <- data.frame(Variable = rownames(summary(mod1_trad_schw)$coef),
                           Coefficient = summary(mod1_trad_schw)$coef[, 1],
                           SE = summary(mod1_trad_schw)$coef[, 2],
                           Domain = "Moral Traditionalism")
model14Frame <- model14Frame[2,]

model15Frame <- data.frame(Variable = rownames(summary(mod1_trad_latent)$coef),
                           Coefficient = summary(mod1_trad_latent)$coef[, 1],
                           SE = summary(mod1_trad_latent)$coef[, 2],
                           Domain = "Moral Traditionalism")
model15Frame <- model15Frame[2,]

model16Frame <- data.frame(Variable = rownames(summary(mod1_econ_auth)$coef),
                           Coefficient = summary(mod1_econ_auth)$coef[, 1],
                           SE = summary(mod1_econ_auth)$coef[, 2],
                           Domain = "Economic Policy")
model16Frame <- model16Frame[2,]

model17Frame <- data.frame(Variable = rownames(summary(mod1_econ_open)$coef),
                           Coefficient = summary(mod1_econ_open)$coef[, 1],
                           SE = summary(mod1_econ_open)$coef[, 2],
                           Domain = "Economic Policy")
model17Frame <- model17Frame[2,]

model18Frame <- data.frame(Variable = rownames(summary(mod1_econ_nfc)$coef),
                           Coefficient = summary(mod1_econ_nfc)$coef[, 1],
                           SE = summary(mod1_econ_nfc)$coef[, 2],
                           Domain = "Economic Policy")
model18Frame <- model18Frame[2,]

model19Frame <- data.frame(Variable = rownames(summary(mod1_econ_schw)$coef),
                           Coefficient = summary(mod1_econ_schw)$coef[, 1],
                           SE = summary(mod1_econ_schw)$coef[, 2],
                           Domain = "Economic Policy")
model19Frame <- model19Frame[2,]

model20Frame <- data.frame(Variable = rownames(summary(mod1_econ_latent)$coef),
                           Coefficient = summary(mod1_econ_latent)$coef[, 1],
                           SE = summary(mod1_econ_latent)$coef[, 2],
                           Domain = "Economic Policy")
model20Frame <- model20Frame[2,]

model21Frame <- data.frame(Variable = rownames(summary(mod1_limgov_auth)$coef),
                           Coefficient = summary(mod1_limgov_auth)$coef[, 1],
                           SE = summary(mod1_limgov_auth)$coef[, 2],
                           Domain = "Limited Government")
model21Frame <- model21Frame[2,]

model22Frame <- data.frame(Variable = rownames(summary(mod1_limgov_open)$coef),
                           Coefficient = summary(mod1_limgov_open)$coef[, 1],
                           SE = summary(mod1_limgov_open)$coef[, 2],
                           Domain = "Limited Government")
model22Frame <- model22Frame[2,]

model23Frame <- data.frame(Variable = rownames(summary(mod1_limgov_nfc)$coef),
                           Coefficient = summary(mod1_limgov_nfc)$coef[, 1],
                           SE = summary(mod1_limgov_nfc)$coef[, 2],
                           Domain = "Limited Government")
model23Frame <- model23Frame[2,]

model24Frame <- data.frame(Variable = rownames(summary(mod1_limgov_schw)$coef),
                           Coefficient = summary(mod1_limgov_schw)$coef[, 1],
                           SE = summary(mod1_limgov_schw)$coef[, 2],
                           Domain = "Limited Government")
model24Frame <- model24Frame[2,]

model25Frame <- data.frame(Variable = rownames(summary(mod1_limgov_latent)$coef),
                           Coefficient = summary(mod1_limgov_latent)$coef[, 1],
                           SE = summary(mod1_limgov_latent)$coef[, 2],
                           Domain = "Limited Government")
model25Frame <- model25Frame[2,]

model26Frame <- data.frame(Variable = rownames(summary(mod1_imports_auth)$coef),
                           Coefficient = summary(mod1_imports_auth)$coef[, 1],
                           SE = summary(mod1_imports_auth)$coef[, 2],
                           Domain = "Free Trade")
model26Frame <- model26Frame[2,]

model27Frame <- data.frame(Variable = rownames(summary(mod1_imports_open)$coef),
                           Coefficient = summary(mod1_imports_open)$coef[, 1],
                           SE = summary(mod1_imports_open)$coef[, 2],
                           Domain = "Free Trade")
model27Frame <- model27Frame[2,]

model28Frame <- data.frame(Variable = rownames(summary(mod1_imports_nfc)$coef),
                           Coefficient = summary(mod1_imports_nfc)$coef[, 1],
                           SE = summary(mod1_imports_nfc)$coef[, 2],
                           Domain = "Free Trade")
model28Frame <- model28Frame[2,]

model29Frame <- data.frame(Variable = rownames(summary(mod1_imports_schw)$coef),
                           Coefficient = summary(mod1_imports_schw)$coef[, 1],
                           SE = summary(mod1_imports_schw)$coef[, 2],
                           Domain = "Free Trade")
model29Frame <- model29Frame[2,]

model30Frame <- data.frame(Variable = rownames(summary(mod1_imports_latent)$coef),
                           Coefficient = summary(mod1_imports_latent)$coef[, 1],
                           SE = summary(mod1_imports_latent)$coef[, 2],
                           Domain = "Free Trade")
model30Frame <- model30Frame[2,]

allModelFrame <- data.frame(rbind(model1Frame, model2Frame, model3Frame, model4Frame, model5Frame, #lr
                                  model6Frame, model7Frame, model8Frame, model9Frame, model10Frame, #cultural
                                  model11Frame, model12Frame,  model13Frame, model14Frame, model15Frame, #moral
                                  model16Frame, model17Frame, model18Frame, model19Frame, model20Frame, # econ
                                  model21Frame, model22Frame, model23Frame,  model24Frame, model25Frame, #limgov
                                  model26Frame, model27Frame, model28Frame, model29Frame, model30Frame)) # trade

allModelFrame$Domain <- factor(allModelFrame$Domain, 
                               levels = c("Left-Right Identification", "Cultural Policy", "Moral Traditionalism", "Economic Policy", "Limited Government", "Free Trade"))
allModelFrame$Variable <- factor(allModelFrame$Variable, 
                                 levels = c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"))


interval2 <- -qnorm((1-0.95)/2) # set 95% CI

zp1 <- ggplot(allModelFrame, aes(x = Domain, y = Coefficient, shape =  Variable))

zp1 <- zp1 + geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)

zp1 <- zp1 + geom_pointrange(aes(x = Domain, y = Coefficient, ymin = Coefficient - SE*interval2, 
                                 ymax = Coefficient + SE*interval2), lwd = 1/2, position = position_dodge(width = 1/2))

zp1 <- zp1 + scale_shape_manual(name = "Personality Measure", 
                                values = c(0,2,1,6,5),
                                breaks=c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"),
                                labels=c("Authoritarianism", "Openness to Experience (RC)", "Need for Closure", "Schwartz Conservation Values", "Latent Openness (RC)"))

zp1 <- zp1 + theme_bw() + theme(text=element_text(family="Times", face="bold", size=12)) +
  theme(axis.title.x = element_blank())
zp1 <- zp1  + ylim(-.55,.55)

zp1
#ggsave(file="", zp1, width = 12, height = 5) 


## Model Type 2 - OLS With Interactions Between Traits and Engagement 

# Left-Right Identification
mod2_lr_nfc <- lm(dv_lr ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_lr_open <- lm(dv_lr ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_lr_schw <- lm(dv_lr ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_lr_auth <- lm(dv_lr ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_lr_latent <- lm(dv_lr ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Economic Issue Preferences
mod2_econ_nfc <- lm(dv_econ ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_econ_open <- lm(dv_econ ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_econ_schw <- lm(dv_econ ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_econ_auth <- lm(dv_econ ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_econ_latent <- lm(dv_econ ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Social Issue Preferences
mod2_social_nfc <- lm(dv_social ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_social_open <- lm(dv_social ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_social_schw <- lm(dv_social ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_social_auth <- lm(dv_social ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_social_latent <- lm(dv_social ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Trade Imports Preferences
mod2_imports_nfc <- lm(dv_imports ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_imports_open <- lm(dv_imports ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_imports_schw <- lm(dv_imports ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_imports_auth <- lm(dv_imports ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_imports_latent <- lm(dv_imports ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Limited Government
mod2_limgov_nfc <- lm(dv_limgov ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_limgov_open <- lm(dv_limgov ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_limgov_schw <- lm(dv_limgov ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_limgov_auth <- lm(dv_limgov ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_limgov_latent <- lm(dv_limgov ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

# Moral Traditionalism
mod2_trad_nfc <- lm(dv_trad ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_trad_open <- lm(dv_trad ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_trad_schw <- lm(dv_trad ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_trad_auth <- lm(dv_trad ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)
mod2_trad_latent <- lm(dv_trad ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale + income_scale + unemp + engagement, data = Lucid2020)

## Effects from 5th to 95th Percentile of Personality Type
attach(Lucid2020)

quantile(nfc_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(open_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(schw_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(auth_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(latent_scale,  probs = c(0.05, 0.95), na.rm = T)

# Left-Right Identification
lr_nfc <- post(mod2_lr_nfc, x1name =  "nfc_scale", x1vals = c(.286,.898), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_open <- post(mod2_lr_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_schw <- post(mod2_lr_schw, x1name =  "schw_scale", x1vals = c(.32,.84), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_auth <- post(mod2_lr_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_latent <- post(mod2_lr_latent, x1name =  "latent_scale", x1vals = c(.337,.870), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Economic Preferences
econ_nfc <- post(mod2_econ_nfc, x1name =  "nfc_scale", x1vals = c(.286,.898), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_open <- post(mod2_econ_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_schw <- post(mod2_econ_schw, x1name =  "schw_scale", x1vals = c(.32,.84), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_auth <- post(mod2_econ_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_latent <- post(mod2_econ_latent, x1name =  "latent_scale", x1vals = c(.337,.870), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Social Preferences
social_nfc <- post(mod2_social_nfc, x1name =  "nfc_scale", x1vals = c(.286,.898), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_open <- post(mod2_social_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_schw <- post(mod2_social_schw, x1name =  "schw_scale", x1vals = c(.32,.84), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_auth <- post(mod2_social_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_latent <- post(mod2_social_latent, x1name =  "latent_scale", x1vals = c(.337,.870), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Trade Import Preferences
imports_nfc <- post(mod2_imports_nfc, x1name =  "nfc_scale", x1vals = c(.286,.898), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_open <- post(mod2_imports_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_schw <- post(mod2_imports_schw, x1name =  "schw_scale", x1vals = c(.32,.84), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_auth <- post(mod2_imports_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_latent <- post(mod2_imports_latent, x1name =  "latent_scale", x1vals = c(.337,.870), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Limited Government Preference
limgov_nfc <- post(mod2_limgov_nfc, x1name =  "nfc_scale", x1vals = c(.286,.898), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_open <- post(mod2_limgov_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_schw <- post(mod2_limgov_schw, x1name =  "schw_scale", x1vals = c(.32,.84), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_auth <- post(mod2_limgov_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_latent <- post(mod2_limgov_latent, x1name =  "latent_scale", x1vals = c(.337,.870), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Moral Traditionalism Preference
trad_nfc <- post(mod2_trad_nfc, x1name =  "nfc_scale", x1vals = c(.286,.898), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_open <- post(mod2_trad_open, x1name =  "open_scale", x1vals = c(0,.65), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_schw <- post(mod2_trad_schw, x1name =  "schw_scale", x1vals = c(.32,.84), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_auth <- post(mod2_trad_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_latent <- post(mod2_trad_latent, x1name =  "latent_scale", x1vals = c(.337,.870), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

detach(Lucid2020)

## Generate Interaction Plots for 4 Personality Measures ##

# LR-ID
#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_auth@est[3,1,1], lr_auth@est[3,1,2], lr_auth@est[3,1,3], lr_auth@est[3,1,4], lr_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_auth@est[3,2,1], lr_auth@est[3,2,2], lr_auth@est[3,2,3], lr_auth@est[3,2,4], lr_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_auth@est[3,3,1], lr_auth@est[3,3,2], lr_auth@est[3,3,3], lr_auth@est[3,3,4], lr_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_open@est[3,1,1], lr_open@est[3,1,2], lr_open@est[3,1,3], lr_open@est[3,1,4], lr_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_open@est[3,2,1], lr_open@est[3,2,2], lr_open@est[3,2,3], lr_open@est[3,2,4], lr_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_open@est[3,3,1], lr_open@est[3,3,2], lr_open@est[3,3,3], lr_open@est[3,3,4], lr_open@est[3,3,5]))
abline(h=0, lty=3)

title("Left-Right Identification", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_nfc@est[3,1,1], lr_nfc@est[3,1,2], lr_nfc@est[3,1,3], lr_nfc@est[3,1,4], lr_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_nfc@est[3,2,1], lr_nfc@est[3,2,2], lr_nfc@est[3,2,3], lr_nfc@est[3,2,4], lr_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_nfc@est[3,3,1], lr_nfc@est[3,3,2], lr_nfc@est[3,3,3], lr_nfc@est[3,3,4], lr_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_schw@est[3,1,1], lr_schw@est[3,1,2], lr_schw@est[3,1,3], lr_schw@est[3,1,4], lr_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_schw@est[3,2,1], lr_schw@est[3,2,2], lr_schw@est[3,2,3], lr_schw@est[3,2,4], lr_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_schw@est[3,3,1], lr_schw@est[3,3,2], lr_schw@est[3,3,3], lr_schw@est[3,3,4], lr_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

# Economic Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_auth@est[3,1,1], econ_auth@est[3,1,2], econ_auth@est[3,1,3], econ_auth@est[3,1,4], econ_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_auth@est[3,2,1], econ_auth@est[3,2,2], econ_auth@est[3,2,3], econ_auth@est[3,2,4], econ_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_auth@est[3,3,1], econ_auth@est[3,3,2], econ_auth@est[3,3,3], econ_auth@est[3,3,4], econ_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_open@est[3,1,1], econ_open@est[3,1,2], econ_open@est[3,1,3], econ_open@est[3,1,4], econ_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_open@est[3,2,1], econ_open@est[3,2,2], econ_open@est[3,2,3], econ_open@est[3,2,4], econ_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_open@est[3,3,1], econ_open@est[3,3,2], econ_open@est[3,3,3], econ_open@est[3,3,4], econ_open@est[3,3,5]))
abline(h=0, lty=3)

title("Economic Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_nfc@est[3,1,1], econ_nfc@est[3,1,2], econ_nfc@est[3,1,3], econ_nfc@est[3,1,4], econ_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_nfc@est[3,2,1], econ_nfc@est[3,2,2], econ_nfc@est[3,2,3], econ_nfc@est[3,2,4], econ_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_nfc@est[3,3,1], econ_nfc@est[3,3,2], econ_nfc@est[3,3,3], econ_nfc@est[3,3,4], econ_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_schw@est[3,1,1], econ_schw@est[3,1,2], econ_schw@est[3,1,3], econ_schw@est[3,1,4], econ_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", ""), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_schw@est[3,2,1], econ_schw@est[3,2,2], econ_schw@est[3,2,3], econ_schw@est[3,2,4], econ_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_schw@est[3,3,1], econ_schw@est[3,3,2], econ_schw@est[3,3,3], econ_schw@est[3,3,4], econ_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Social Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_auth@est[3,1,1], social_auth@est[3,1,2], social_auth@est[3,1,3], social_auth@est[3,1,4], social_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_auth@est[3,2,1], social_auth@est[3,2,2], social_auth@est[3,2,3], social_auth@est[3,2,4], social_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_auth@est[3,3,1], social_auth@est[3,3,2], social_auth@est[3,3,3], social_auth@est[3,3,4], social_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_open@est[3,1,1], social_open@est[3,1,2], social_open@est[3,1,3], social_open@est[3,1,4], social_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_open@est[3,2,1], social_open@est[3,2,2], social_open@est[3,2,3], social_open@est[3,2,4], social_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_open@est[3,3,1], social_open@est[3,3,2], social_open@est[3,3,3], social_open@est[3,3,4], social_open@est[3,3,5]))
abline(h=0, lty=3)

title("Cultural Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_nfc@est[3,1,1], social_nfc@est[3,1,2], social_nfc@est[3,1,3], social_nfc@est[3,1,4], social_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_nfc@est[3,2,1], social_nfc@est[3,2,2], social_nfc@est[3,2,3], social_nfc@est[3,2,4], social_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_nfc@est[3,3,1], social_nfc@est[3,3,2], social_nfc@est[3,3,3], social_nfc@est[3,3,4], social_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_schw@est[3,1,1], social_schw@est[3,1,2], social_schw@est[3,1,3], social_schw@est[3,1,4], social_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_schw@est[3,2,1], social_schw@est[3,2,2], social_schw@est[3,2,3], social_schw@est[3,2,4], social_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_schw@est[3,3,1], social_schw@est[3,3,2], social_schw@est[3,3,3], social_schw@est[3,3,4], social_schw@est[3,3,5]))
abline(h=0, lty=3)


dev.off()

## Imports

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_auth@est[3,1,1], imports_auth@est[3,1,2], imports_auth@est[3,1,3], imports_auth@est[3,1,4], imports_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_auth@est[3,2,1], imports_auth@est[3,2,2], imports_auth@est[3,2,3], imports_auth@est[3,2,4], imports_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_auth@est[3,3,1], imports_auth@est[3,3,2], imports_auth@est[3,3,3], imports_auth@est[3,3,4], imports_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_open@est[3,1,1], imports_open@est[3,1,2], imports_open@est[3,1,3], imports_open@est[3,1,4], imports_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_open@est[3,2,1], imports_open@est[3,2,2], imports_open@est[3,2,3], imports_open@est[3,2,4], imports_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_open@est[3,3,1], imports_open@est[3,3,2], imports_open@est[3,3,3], imports_open@est[3,3,4], imports_open@est[3,3,5]))
abline(h=0, lty=3)

title("Free Trade Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_nfc@est[3,1,1], imports_nfc@est[3,1,2], imports_nfc@est[3,1,3], imports_nfc@est[3,1,4], imports_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_nfc@est[3,2,1], imports_nfc@est[3,2,2], imports_nfc@est[3,2,3], imports_nfc@est[3,2,4], imports_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_nfc@est[3,3,1], imports_nfc@est[3,3,2], imports_nfc@est[3,3,3], imports_nfc@est[3,3,4], imports_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_schw@est[3,1,1], imports_schw@est[3,1,2], imports_schw@est[3,1,3], imports_schw@est[3,1,4], imports_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40, .50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_schw@est[3,2,1], imports_schw@est[3,2,2], imports_schw@est[3,2,3], imports_schw@est[3,2,4], imports_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_schw@est[3,3,1], imports_schw@est[3,3,2], imports_schw@est[3,3,3], imports_schw@est[3,3,4], imports_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Limited Government Index

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_auth@est[3,1,1], limgov_auth@est[3,1,2], limgov_auth@est[3,1,3], limgov_auth@est[3,1,4], limgov_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.70,-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("","-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_auth@est[3,2,1], limgov_auth@est[3,2,2], limgov_auth@est[3,2,3], limgov_auth@est[3,2,4], limgov_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_auth@est[3,3,1], limgov_auth@est[3,3,2], limgov_auth@est[3,3,3], limgov_auth@est[3,3,4], limgov_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_open@est[3,1,1], limgov_open@est[3,1,2], limgov_open@est[3,1,3], limgov_open@est[3,1,4], limgov_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_open@est[3,2,1], limgov_open@est[3,2,2], limgov_open@est[3,2,3], limgov_open@est[3,2,4], limgov_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_open@est[3,3,1], limgov_open@est[3,3,2], limgov_open@est[3,3,3], limgov_open@est[3,3,4], limgov_open@est[3,3,5]))
abline(h=0, lty=3)

title("Principles of Limited Government", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_nfc@est[3,1,1], limgov_nfc@est[3,1,2], limgov_nfc@est[3,1,3], limgov_nfc@est[3,1,4], limgov_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_nfc@est[3,2,1], limgov_nfc@est[3,2,2], limgov_nfc@est[3,2,3], limgov_nfc@est[3,2,4], limgov_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_nfc@est[3,3,1], limgov_nfc@est[3,3,2], limgov_nfc@est[3,3,3], limgov_nfc@est[3,3,4], limgov_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_schw@est[3,1,1], limgov_schw@est[3,1,2], limgov_schw@est[3,1,3], limgov_schw@est[3,1,4], limgov_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_schw@est[3,2,1], limgov_schw@est[3,2,2], limgov_schw@est[3,2,3], limgov_schw@est[3,2,4], limgov_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_schw@est[3,3,1], limgov_schw@est[3,3,2], limgov_schw@est[3,3,3], limgov_schw@est[3,3,4], limgov_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Moral Traditionalism

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=9)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_auth@est[3,1,1], trad_auth@est[3,1,2], trad_auth@est[3,1,3], trad_auth@est[3,1,4], trad_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_auth@est[3,2,1], trad_auth@est[3,2,2], trad_auth@est[3,2,3], trad_auth@est[3,2,4], trad_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_auth@est[3,3,1], trad_auth@est[3,3,2], trad_auth@est[3,3,3], trad_auth@est[3,3,4], trad_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_open@est[3,1,1], trad_open@est[3,1,2], trad_open@est[3,1,3], trad_open@est[3,1,4], trad_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_open@est[3,2,1], trad_open@est[3,2,2], trad_open@est[3,2,3], trad_open@est[3,2,4], trad_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_open@est[3,3,1], trad_open@est[3,3,2], trad_open@est[3,3,3], trad_open@est[3,3,4], trad_open@est[3,3,5]))
abline(h=0, lty=3)

title("Moral Traditionalism", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_nfc@est[3,1,1], trad_nfc@est[3,1,2], trad_nfc@est[3,1,3], trad_nfc@est[3,1,4], trad_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_nfc@est[3,2,1], trad_nfc@est[3,2,2], trad_nfc@est[3,2,3], trad_nfc@est[3,2,4], trad_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_nfc@est[3,3,1], trad_nfc@est[3,3,2], trad_nfc@est[3,3,3], trad_nfc@est[3,3,4], trad_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_schw@est[3,1,1], trad_schw@est[3,1,2], trad_schw@est[3,1,3], trad_schw@est[3,1,4], trad_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_schw@est[3,2,1], trad_schw@est[3,2,2], trad_schw@est[3,2,3], trad_schw@est[3,2,4], trad_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_schw@est[3,3,1], trad_schw@est[3,3,2], trad_schw@est[3,3,3], trad_schw@est[3,3,4], trad_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## OPENNESS FIGURE ##

#jpeg(file="", type="cairo", height = 10, width = 8.5, family="sans", units = 'in', res=1800, pointsize=12)

par(mfrow=c(3,2))

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_latent@est[3,1,1], lr_latent@est[3,1,2], lr_latent@est[3,1,3], lr_latent@est[3,1,4], lr_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel A: Left-Right Identification"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_latent@est[3,2,1], lr_latent@est[3,2,2], lr_latent@est[3,2,3], lr_latent@est[3,2,4], lr_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_latent@est[3,3,1], lr_latent@est[3,3,2], lr_latent@est[3,3,3], lr_latent@est[3,3,4], lr_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_latent@est[3,1,1], social_latent@est[3,1,2], social_latent@est[3,1,3], social_latent@est[3,1,4], social_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel B: Cultural Policy Preferences"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_latent@est[3,2,1], social_latent@est[3,2,2], social_latent@est[3,2,3], social_latent@est[3,2,4], social_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_latent@est[3,3,1], social_latent@est[3,3,2], social_latent@est[3,3,3], social_latent@est[3,3,4], social_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_latent@est[3,1,1], trad_latent@est[3,1,2], trad_latent@est[3,1,3], trad_latent@est[3,1,4], trad_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel C: Moral Traditionalism"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_latent@est[3,2,1], trad_latent@est[3,2,2], trad_latent@est[3,2,3], trad_latent@est[3,2,4], trad_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_latent@est[3,3,1], trad_latent@est[3,3,2], trad_latent@est[3,3,3], trad_latent@est[3,3,4], trad_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_latent@est[3,1,1], econ_latent@est[3,1,2], econ_latent@est[3,1,3], econ_latent@est[3,1,4], econ_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel D: Economic Policy Preferences"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_latent@est[3,2,1], econ_latent@est[3,2,2], econ_latent@est[3,2,3], econ_latent@est[3,2,4], econ_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_latent@est[3,3,1], econ_latent@est[3,3,2], econ_latent@est[3,3,3], econ_latent@est[3,3,4], econ_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_latent@est[3,1,1], limgov_latent@est[3,1,2], limgov_latent@est[3,1,3], limgov_latent@est[3,1,4], limgov_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel E: Principles of Limited Government"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_latent@est[3,2,1], limgov_latent@est[3,2,2], limgov_latent@est[3,2,3], limgov_latent@est[3,2,4], limgov_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_latent@est[3,3,1], limgov_latent@est[3,3,2], limgov_latent@est[3,3,3], limgov_latent@est[3,3,4], limgov_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_latent@est[3,1,1], imports_latent@est[3,1,2], imports_latent@est[3,1,3], imports_latent@est[3,1,4], imports_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.60,.45), 
     xlim=c(0,1))
title(main=list("Panel F: Free Trade Preferences"))
axis(2, at=c(-.60,-.50,-.40, -.30,-.20,-.10,.00,.10,.20,.30,.40,.50, .60), labels=c("-.60","","-.40","","-.20","",".00","",".20","", ".40", "", ".60"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_latent@est[3,2,1], imports_latent@est[3,2,2], imports_latent@est[3,2,3], imports_latent@est[3,2,4], imports_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_latent@est[3,3,1], imports_latent@est[3,3,2], imports_latent@est[3,3,3], imports_latent@est[3,3,4], imports_latent@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

##### Appendix 6 Figures #####
library(ggplot2)
library(interflex)

# Left-Right Identification
lr_nfc <- interflex(data = Replication, Y = "dv_lr", D = "nfc_scale", X = "engagement", 
                    Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                    estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                    theme.bw = TRUE, show.grid = FALSE, 
                    main = "Panel B: Need for Closure", 
                    xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(lr_nfc$figure)
dev.off()


lr_open <- interflex(data = Replication, Y = "dv_lr", D = "open_scale", X = "engagement", 
                     Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                     estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                     theme.bw = TRUE, show.grid = FALSE, 
                     main = "Panel C: Openness to Experience", 
                     xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(lr_open$figure)
dev.off()

lr_schw <- interflex(data = Replication, Y = "dv_lr", D = "schw_scale", X = "engagement", 
                     Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                     estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                     theme.bw = TRUE, show.grid = FALSE, 
                     main = "Panel D: Schwartz Values", 
                     xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(lr_schw$figure)
dev.off()

lr_auth <- interflex(data = Replication, Y = "dv_lr", D = "auth_scale", X = "engagement", 
                     Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                     estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                     theme.bw = TRUE, show.grid = FALSE, 
                     main = "Panel A: Authoritarianism", 
                     xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(lr_auth$figure)
dev.off()

lr_latent <- interflex(data = Replication, Y = "dv_lr", D = "latent_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel E: Latent Openness", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(lr_latent$figure)
dev.off()

# Economic Policy 
econ_nfc <- interflex(data = Replication, Y = "dv_econ", D = "nfc_scale", X = "engagement", 
                      Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                      estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                      theme.bw = TRUE, show.grid = FALSE, 
                      main = "Panel B: Need for Closure", 
                      xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(econ_nfc$figure)
dev.off()


econ_open <- interflex(data = Replication, Y = "dv_econ", D = "open_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel C: Openness to Experience", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(econ_open$figure)
dev.off()

econ_schw <- interflex(data = Replication, Y = "dv_econ", D = "schw_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel D: Schwartz Values", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(econ_schw$figure)
dev.off()

econ_auth <- interflex(data = Replication, Y = "dv_econ", D = "auth_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel A: Authoritarianism", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(econ_auth$figure)
dev.off()

econ_latent <- interflex(data = Replication, Y = "dv_econ", D = "latent_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel E: Latent Openness", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(econ_latent$figure)
dev.off()

# Social Policy 
social_nfc <- interflex(data = Replication, Y = "dv_social", D = "nfc_scale", X = "engagement", 
                        Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                        estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                        theme.bw = TRUE, show.grid = FALSE, 
                        main = "Panel B: Need for Closure", 
                        xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(social_nfc$figure)
dev.off()


social_open <- interflex(data = Replication, Y = "dv_social", D = "open_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel C: Openness to Experience", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(social_open$figure)
dev.off()

social_schw <- interflex(data = Replication, Y = "dv_social", D = "schw_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel D: Schwartz Values", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(social_schw$figure)
dev.off()

social_auth <- interflex(data = Replication, Y = "dv_social", D = "auth_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel A: Authoritarianism", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(social_auth$figure)
dev.off()

social_latent <- interflex(data = Replication, Y = "dv_social", D = "latent_scale", X = "engagement", 
                           Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                           estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                           theme.bw = TRUE, show.grid = FALSE, 
                           main = "Panel E: Latent Openness", 
                           xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(social_latent$figure)
dev.off()

# Imports Policy 
imports_nfc <- interflex(data = Replication, Y = "dv_imports", D = "nfc_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel B: Need for Closure", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(imports_nfc$figure)
dev.off()


imports_open <- interflex(data = Replication, Y = "dv_imports", D = "open_scale", X = "engagement", 
                          Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                          estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                          theme.bw = TRUE, show.grid = FALSE, 
                          main = "Panel C: Openness to Experience", 
                          xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(imports_open$figure)
dev.off()

imports_schw <- interflex(data = Replication, Y = "dv_imports", D = "schw_scale", X = "engagement", 
                          Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                          estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                          theme.bw = TRUE, show.grid = FALSE, 
                          main = "Panel D: Schwartz Values", 
                          xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="Plots/Binning Estimates/imports_schw.png", width=600, height=450)
plot(imports_schw$figure)
dev.off()

imports_auth <- interflex(data = Replication, Y = "dv_imports", D = "auth_scale", X = "engagement", 
                          Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                          estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                          theme.bw = TRUE, show.grid = FALSE, 
                          main = "Panel A: Authoritarianism", 
                          xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(imports_auth$figure)
dev.off()

imports_latent <- interflex(data = Replication, Y = "dv_imports", D = "latent_scale", X = "engagement", 
                            Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                            estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                            theme.bw = TRUE, show.grid = FALSE, 
                            main = "Panel E: Latent Openness", 
                            xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(imports_latent$figure)
dev.off()

# Limited Government 
limgov_nfc <- interflex(data = Replication, Y = "dv_limgov", D = "nfc_scale", X = "engagement", 
                        Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                        estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                        theme.bw = TRUE, show.grid = FALSE, 
                        main = "Panel B: Need for Closure", 
                        xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(limgov_nfc$figure)
dev.off()


limgov_open <- interflex(data = Replication, Y = "dv_limgov", D = "open_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel C: Openness to Experience", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(limgov_open$figure)
dev.off()

limgov_schw <- interflex(data = Replication, Y = "dv_limgov", D = "schw_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel D: Schwartz Values", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(limgov_schw$figure)
dev.off()

limgov_auth <- interflex(data = Replication, Y = "dv_limgov", D = "auth_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel A: Authoritarianism", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(limgov_auth$figure)
dev.off()

limgov_latent <- interflex(data = Replication, Y = "dv_limgov", D = "latent_scale", X = "engagement", 
                           Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                           estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                           theme.bw = TRUE, show.grid = FALSE, 
                           main = "Panel E: Latent Openness", 
                           xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(limgov_latent$figure)
dev.off()

# Moral Traditionalism
trad_nfc <- interflex(data = Replication, Y = "dv_trad", D = "nfc_scale", X = "engagement", 
                      Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                      estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                      theme.bw = TRUE, show.grid = FALSE, 
                      main = "Panel B: Need for Closure", 
                      xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(trad_nfc$figure)
dev.off()


trad_open <- interflex(data = Replication, Y = "dv_trad", D = "open_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel C: Openness to Experience", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(trad_open$figure)
dev.off()

trad_schw <- interflex(data = Replication, Y = "dv_trad", D = "schw_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel D: Schwartz Values", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(trad_schw$figure)
dev.off()

trad_auth <- interflex(data = Replication, Y = "dv_trad", D = "auth_scale", X = "engagement", 
                       Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                       estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                       theme.bw = TRUE, show.grid = FALSE, 
                       main = "Panel A: Authoritarianism", 
                       xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(trad_auth$figure)
dev.off()

trad_latent <- interflex(data = Replication, Y = "dv_trad", D = "latent_scale", X = "engagement", 
                         Z = c("age_scale", "male", "black", "hisp", "educ_scale", "income_scale", "unemp"), 
                         estimator = "binning", nbins = 3, vcov.type = "robust", na.rm = T,
                         theme.bw = TRUE, show.grid = FALSE, 
                         main = "Panel E: Latent Openness", 
                         xlab = "Political Engagement", ylab = "Marginal Effect")

#png(file="", width=600, height=450)
plot(trad_latent$figure)
dev.off()






